/**************************************
题目:求100以内的素数,全部打印出来
**************************************/
#include<stdio.h>
void Prime(void)
{
int i = 0;
int j = 0;
int flag = 0;
printf ("Prime numbers are : \n");
for (i = 2; i <= 100; i++)
{
for (j = 2; j < i; j++)
{
if (i % j == 0)
{
flag = 1;
break;
}
}
if (flag != 1)
{
printf ("%d ", i);
}
flag = 0;
}
}
int main()
{
Prime();
printf("\n");
return 0;
}
题目:求100以内的素数,全部打印出来
**************************************/
#include<stdio.h>
void Prime(void)
{
int i = 0;
int j = 0;
int flag = 0;
printf ("Prime numbers are : \n");
for (i = 2; i <= 100; i++)
{
for (j = 2; j < i; j++)
{
if (i % j == 0)
{
flag = 1;
break;
}
}
if (flag != 1)
{
printf ("%d ", i);
}
flag = 0;
}
}
int main()
{
Prime();
printf("\n");
return 0;
}