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
How reliable are floating-point comparisons?
Tell me when is a void pointer used?
What is getche() function?
Write a program to swap two numbers without using the third variable?
Why is c called a structured programming language?
write a c program to print the next of a particular no without using the arithmetic operator or looping statements?
What is output redirection?
Can you please explain the difference between syntax vs logical error?
What is the difference between class and object in c?
write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays
What is the difference between array_name and &array_name?
Explain the difference between strcpy() and memcpy() function?
What is a macro, and explain how do you use it?
What are the types of pointers?
What are the 4 data types?