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 oops means?
What do you mean by scope of a variable in c?
Can we increase size of array in c?
What is cohesion in c?
Explain what are its uses in c programming?
typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none
Explain what is operator promotion?
p*=(++q)++*--p when p=q=1 while(q<=6)
What is the ANSI C Standard?
What is the code for 3 questions and answer check in VisualBasic.Net?
What is .obj file in c?
what do u mean by Direct access files? then can u explain about Direct Access Files?
in ‘C’ language for Matrix Multiplication fails” Introspect the causes for its failure and write down the possible reasons for its failure.
How main function is called in c?
Describe the header file and its usage in c programming?