Please write me a program to print the first 50 prime
numbers (NOT between the range 1 -50)
Answer Posted / sofi
#include <stdio.h>
#include <conio.h>
main()
{
int num,count_prime=1,divisor;
//clrscr();
num =1; //it will exclude all less then 50
while(count_prime!=50)
{
for(divisor=2;divisor<=num;divisor++)
{
if (num % divisor==0)
{ break;
}
}
if(num==divisor)
{
printf("\n%d",num);
count_prime++;
}
num++;
}
getch();
}
| Is This Answer Correct ? | 10 Yes | 21 No |
Post New Answer View All Answers
What do you mean by keywords in c?
Can you write a programmer for FACTORIAL using recursion?
How do I read the arrow keys? What about function keys?
What does c mean in standard form?
#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} wat would be the output??
Explain void pointer?
Can we initialize extern variable in c?
code for quick sort?
Can the sizeof operator be used to tell the size of an array passed to a function?
When can a far pointer be used?
What is atoi and atof in c?
What is the difference between if else and switchstatement
How to explain the final year project as a fresher please answer with sample project
What is void pointers in c?
What does it mean when a pointer is used in an if statement?