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 data structures in c and how to use them?
What is a void * in c?
How can I read data from data files with particular formats?
How do I use void main?
What is the translation phases used in c language?
Explain the difference between exit() and _exit() function?
Can you tell me how to check whether a linked list is circular?
How can I use a preprocessorif expression to ?
What is property type c?
Explain the difference between malloc() and calloc() function?
What is a list in c?
show how link list can be used to repersent the following polynomial i) 5x+2
What is mean by Data Driven framework in QTP? Can any one answer me in details on this regard.
What are formal parameters?
A function can make the value of a variable available to another by a) declaring the variable as global variable b) Passing the variable as a parameter to the second function c) Either of the two methods in (A) and (B) d) binary stream