forked from goldendeepkaur/PPS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathp17.c
More file actions
24 lines (24 loc) · 3.68 KB
/
p17.c
File metadata and controls
24 lines (24 loc) · 3.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//PROGRAM TO PRINT PRIME NUMBERS FROM 1 TO 100
#include <stdio.h>
void main()
{
int i, Number, flag;
printf("\nPrime Numbers from 1 to 100 are:: \n");
for(Number = 1; Number <= 100; Number++)
{
flag = 0;
for (i = 2; i <= Number/2; i++)
{
if(Number%i == 0)
{
flag=1;
break;
}
}
if(flag == 0 && Number != 1 )
{
printf("%d ", Number);
}
}
printf("\n");
}