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
What is the difference between scanf and fscanf?
What is the difference between call by value and call by reference in c?
What is the condition that is applied with ?: Operator?
write a program to print the consecutive repeated character from the given string... input string is : hhhhjkutskkkkkggggj output should be like this: hhhhkkkkkgggg anyone help me...
Explain what is the difference between the expression '++a' and 'a++'?
Where are the auto variables stored?
What is the difference between struct and union in C?
PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE
Write a program of prime number using recursion.
Why is not a pointer null after calling free?
Write a program to input the price of 1 burger and the number of burgers eaten by a group of friends .print the total amount to be paid by the group?
a number whose only prime factors are 2,3,5, and 7 is call humble number,,write a program to find and display the nth element in this sequence.. sample input : 2,3,4,11,12,13, and 100.. sample output : the 2nd humble number is 2,the 3rd humble number is 3,the 4th humble number is ,the 11th humble number is 12, the 12th humble number is 14, the 13th humble number is 15, the 100th humble number is 450.
What are the advantage of c language?
What is && in c programming?
Are the expressions * ptr ++ and ++ * ptr same?