Please write me a program to print the first 50 prime
numbers (NOT between the range 1 -50)
Answer Posted / ankurmohansharma
#include<stdio.h>
#include<conio.h>
main()
{
int loop_counter,count_prime=1,divisor;
clrscr();
loop_counter=51; //it will exclude all less then 50
while(count_prime!=50)
{
for(divisor=2;divisor<=loop_counter-1;divisor++)
{
if (loop_counter % divisor==0)
{ break;
}
}
if(loop_counter==divisor)
{
printf("\n%d",loop_counter);
count_prime++;
}
loop_counter++;
}
getch();
}
| Is This Answer Correct ? | 8 Yes | 19 No |
Post New Answer View All Answers
What are file streams?
write a program to copy the string using switch case?
Why do we use pointer to pointer in c?
simple program of graphics and their output display
Is null always defined as 0(zero)?
What is the size of array float a(10)?
What is anagram in c?
How can I invoke another program (a standalone executable, or an operating system command) from within a c program?
How can you draw circles in C?
we need to calculating INCOME TAX for the person. The INCOME TAX is as follows:- First $10000/- of income : 4% tax Next $10000/- of income : 8% tax Next $10000/- of income : 11.5% tax above $10, 00,00/- : 15% tax What is the Solution of this Question ?
Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
What is #include conio h?
How is a macro different from a function?
What is string in c language?
What are structures and unions? State differencves between them.