当前位置:网站首页>Zzuli:1057 prime number determination
Zzuli:1057 prime number determination
2022-07-03 14:34:00 【Snake_____】
Title Description
Enter a positive integer n, Judge n Is it a prime , if n Prime number , Output ”Yes”, Otherwise output ”No”. Be careful :1 Not primes .
Input
Enter a positive integer n(n<=1000)
Output
If n Is the prime output "Yes", Otherwise output "No". Output takes up one line .
The sample input Copy
2
Sample output Copy
Yes
Tips
Be careful :1 Not primes .
Be careful :1 Not primes .
Be careful :1 Not primes .
#include <stdio.h>
int main()
{
int i,n,b = 0;
scanf("%d",&n);
if(n==1)
printf("No");
else
{
for(i=2;i<n;i++)
{
if(n%i==0)
{
b=1;
break;
}
else
continue;
}
if(b==0)
printf("Yes");
else
if (b==1)
printf("No");}
return 0;
}
边栏推荐
- Etcd cluster permission management and account password usage
- Similarities and differences between Allegro, OrCAD, net alias, port, off page connector and how to select them
- Frequently asked questions: PHP LDAP_ add(): Add: Undefined attribute type in
- Too many files with unapproved license
- retrofit
- Leetcode (4) -- find the median of two positively ordered arrays
- tonybot 人形机器人 查看端口并对应端口 0701
- [qingniaochangping campus of Peking University] in the Internet industry, which positions are more popular as they get older?
- Why is this error reported when modifying records in the database
- 【7.3】146. LRU缓存机制
猜你喜欢
天谋科技 Timecho 完成近亿元人民币天使轮融资,打造工业物联网原生时序数据库
Four data flows and cases of grpc
Code writing and playing method of tonybot humanoid robot at fixed distance
Thinking about the arrangement problem in the backtracking problem (leetcode questions 46 and 47)
Programming language: the essence of type system
Tiantu investment sprint Hong Kong stocks: asset management scale of 24.9 billion, invested in xiaohongshu and Naixue
提高效率 Or 增加成本,开发人员应如何理解结对编程?
Concat and concat_ Ws() differences and groups_ Use of concat() and repeat() functions
tonybot 人形机器人 定距移动 代码编写玩法
7-15 calculation of PI
随机推荐
Thread. Sleep and timeunit SECONDS. The difference between sleep
Paper sharing: generating playful palettes from images
X86 assembly language - Notes from real mode to protected mode
关于敏捷的一些概念
Zabbix添加Calculated items后保存页面成空白
7-24 reduction of the simplest fraction (rolling Division)
Tiantu investment sprint Hong Kong stocks: asset management scale of 24.9 billion, invested in xiaohongshu and Naixue
How to query the baby category of tmall on Taobao
String sort
Find books ()
Etcd cluster permission management and account password usage
【北大青鸟昌平校区】互联网行业中,哪些岗位越老越吃香?
Understanding of closures
Tonybot humanoid robot checks the port and corresponds to port 0701
Find the sum of the elements of each row of the matrix
dllexport和dllimport
Doris学习笔记之数据表的创建
pyQt界面制作(登录+跳转页面)
String reverse order
编程语言:类型系统的本质