write a Program to dispaly upto 100 prime numbers(without
using Arrays,Pointer)
Answer Posted / abhay
#include<stdio.h>
#include<conio.h>
void main()
{
int flag,x;
clrscr();
printf("1\t");
for(int i=1;i<=100;i++)
{
flag=0;
for(x=2;x<=i;x++)
{
if(i%x==0)
{
flag=1;
break;
}
else
continue;
}
if(i==x)
printf("%d\t",i);
}
getch();
}
| Is This Answer Correct ? | 291 Yes | 108 No |
Post New Answer View All Answers
What is s in c?
Can I use base-2 constants (something like 0b101010)? Is there a printf format for binary?
What is getch?
What is operator precedence?
What is return type in c?
What is the benefit of using #define to declare a constant?
What’s a signal? Explain what do I use signals for?
What are the valid places to have keyword “break”?
write a program for the normal snake games find in most of the mobiles.
Can we increase size of array in c?
What is conio h in c?
When is a “switch” statement preferable over an “if” statement?
What is the difference between array_name and &array_name?
What do you mean by Recursion Function?
Is flag a keyword in c?