Write a program to print prime numbers between 1 to 100 -c program
Write a program to print prime numbers between 1 to 100.
Solutions :
#include<stdio.h>
int main()
{
int a;
int b;
int c;
printf("Prime number from 1 to 100 :");
for(a=1;a<=100;a++)
{
c=0;
for(b=1;b<=a;b++)
{
if(a%b==0)
{
c++;
}
}
if(c==2)
{
printf("\n%d",a);
}
}
return 0;
}
0 Comments