write a program to find the prime number from 1 to 100 in c?
#include<stdio.h>
#include<conio.h>
main()
{
int i,j,f;
for(i=1;i<=100;i++)
{
f=0;
for(j=1;j<=i;j++)
{
if(i%j==0)
f=f+1;
}
if(f==2)
{
printf("The No Is Prime %d\n",i);
}
}
getch();
}
#include<stdio.h>
#include<conio.h>
main()
{
int i,j,f;
for(i=1;i<=100;i++)
{
f=0;
for(j=1;j<=i;j++)
{
if(i%j==0)
f=f+1;
}
if(f==2)
{
printf("The No Is Prime %d\n",i);
}
}
getch();
}
No comments:
Post a Comment