当前位置:网站首页>A simple prime number program. Beginners hope that older bosses can have a look
A simple prime number program. Beginners hope that older bosses can have a look
2022-07-27 00:28:00 【Deep dream, high ambition, floating life like a dream】
#include <stdio.h>
int main()
{
int k;
void prime(int k);
int flag = 1;
char ch;
while(flag)
{
printf(" Enter a number to judge whether it is a prime number ");
scanf_s("%d", &k);
prime(k);
printf(" Input N End judgment or continue ");
getchar();
ch=getchar();
if (ch == 'N' || ch == 'n')
flag = 0;
}
}
void prime(int k)
{
int i;
for (i = 2; i <= k / 2; i++)
if (k % i == 0)
{
printf("%d is not prime", k);
break;
}
else if(i==k/2)
printf("%d is prime", k);
}
边栏推荐
- 20220720 toss deeplobcut2
- 我的第一篇博客-迷茫的大三人
- Viterbi Viterbi decoding bit error rate simulation, modulation is QPSK, channel is Gaussian white noise
- 解析网页的完整回顾
- Knowledge distillation -- pytorch implementation
- Xshell连接服务器时报“Could not load host key”错误
- 放图仓库-3(功能图像)
- 7_ Principal component analysis
- Convolutional neural network -- lenet (pytorch Implementation)
- "Syntaxerror: future feature annotations is not defined"
猜你喜欢
随机推荐
Drawing warehouse-2 (function image)
[PCB open source sharing] stc8a8k64d4 development board
Matlab based medical imaging technology filtering backprojection simulation, including direct backprojection, S-L filtering, R-L filtering, LeWitt filtering
2022_ SummerBlog_ 008
Mysql常用函数(汇总)
【4.1 质数及线性筛】
C and pointer Chapter 18 runtime environment 18.7 problems
12_决策树(Decision tree)
deeplabcut使用1
Drawing warehouse-3 (functional image)
7_主成分分析法(Principal Component Analysis)
Signal and system impulse response and step response
【4.6 中国剩余定理详解】
Three tier architecture simulation
C and pointer Chapter 18 runtime environment 18.2 interface between C and assembly language
动态联编和静态联编、以及多态
AlexNet(Pytorch实现)
10_评价分类结果(Evaluate classification)
Huffman encoding and decoding
In JS, the common writing methods and calling methods of functions - conventional writing, anonymous function writing, taking the method as an object, and adding methods to the object in the construct









