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
Explain what are the different file extensions involved when programming in c?
Explain the meaning of keyword 'extern' in a function declaration.
Why we use void main in c?
What is difference between structure and union with example?
Write a c program to demonstrate character and string constants?
What is the purpose of ftell?
What is double pointer in c?
What is dynamic dispatch in c++?
What is getch c?
Write a program to compute the similarity between two strings - The program should get the two strings as input - Then it will output one single number which is the percentage of similarity between the two strings
What does dm mean sexually?
What is a macro?
What is n in c?
Is it possible to initialize a variable at the time it was declared?
What is meant by gets in c?