write a Program to dispaly upto 100 prime numbers(without
using Arrays,Pointer)
Answer Posted / nikhil
#include<stdio.h>
#include<conio.h>
void main()
{
int m,flag;
flag=0;
for(int i=2;i<100;i++)
{
for(int j=1;j<i;j++)
{
if(i%j==0)
{flag++;
}
}
if(flag==2)
{printf("it is prime %d",i);
}
}
getch();
}
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
Is exit(status) truly equivalent to returning the same status from main?
Can you write the function prototype, definition and mention the other requirements.
What is c preprocessor mean?
Why is this loop always executing once?
What is character constants?
What is wrong with this statement? Myname = 'robin';
Explain how can you tell whether a program was compiled using c versus c++?
What is the difference between void main and main in c?
How do I copy files?
Why do we use & in c?
What is the hardest programming language?
What is the difference between abs() and fabs() functions?
What is the difference between malloc() and calloc()?
Are there constructors in c?
What is c language in simple words?