write a Program to dispaly upto 100 prime numbers(without
using Arrays,Pointer)
Answer Posted / sureshbobra
#include<stdio.h>
#include<conio.h>
main()
{
int flag,i,j;
clrscr();
for(i=1;i<=100;i++)
{
flag=0;
for(j=2;j<=i;j++)
{
if(i%j==0)
{
flag++;
}
}
if(flag==1)
printf("%d\t",i);
}
getch();
}
Is This Answer Correct ? | 2 Yes | 6 No |
Post New Answer View All Answers
How does #define work?
What is this infamous null pointer, anyway?
What is the difference between printf and scanf in c?
FORMATTED INPUT/OUTPUT functions are a) scanf() and printf() b) gets() and puts() c) getchar() and putchar() d) all the above
What is the main difference between calloc () and malloc ()?
What is the purpose of the following code? Is there any problem with the code? void send(int count, short *to, short *from) { /* count > 0 assumed */ register n = (count + 7) / 8; switch (count % 8) { case 0: do { *to = *from++; case 7: *to = *from++; case 6: *to = *from++; case 5: *to = *from++; case 4: *to = *from++; case 3: *to = *from++; case 2: *to = *from++; case 1: *to = *from++; } while (--n > 0); } }
What is external variable in c?
What is the use of bitwise operator?
What are the difference between a free-standing and a hosted environment?
Differentiate between #include<...> and #include '...'
When should you use a type cast?
How can I write data files which can be read on other machines with different word size, byte order, or floating point formats?
Where local variables are stored in c?
State the difference between x3 and x[3].
What are the general description for loop statement and available loop types in c?