Write a program to print all prime numbers from 1 to 300. (Hint: Use nested loops, break and continue)
void main() { int d,f,e; printf("\Input a number to print all the prime numbers from 1 to that value\n"); scanf("%d",&e); printf("The prime numbers are 2");
void main() { int d,f,e; printf("\Input a number to print all the prime numbers from 1 to that value\n"); scanf("%d",&e); printf("The prime numbers are 2");
void main()
ReplyDelete{
int d,f,e;
printf("\Input a number to print all the prime numbers from 1 to that value\n");
scanf("%d",&e);
printf("The prime numbers are 2");
for(d=3;d<=e;d++)
{
for(f=2;f<(d/2);d++)
{
if(d%f==0)
break;
else
printf(" %d",d);
}
}
}
thanks
ReplyDeleteThanks 😊
ReplyDelete