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


Please Help Members By Posting Answers For Below Questions

What oops means?

745


What do you mean by scope of a variable in c?

762


Can we increase size of array in c?

711


What is cohesion in c?

740


Explain what are its uses in c programming?

792


typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none

970


Explain what is operator promotion?

831


p*=(++q)++*--p when p=q=1 while(q<=6)

1486


What is the ANSI C Standard?

998


What is the code for 3 questions and answer check in VisualBasic.Net?

1913


What is .obj file in c?

840


what do u mean by Direct access files? then can u explain about Direct Access Files?

1842


in ‘C’ language for Matrix Multiplication fails” Introspect the causes for its failure and write down the possible reasons for its failure.

7771


How main function is called in c?

826


Describe the header file and its usage in c programming?

826