Please write me a program to print the first 50 prime
numbers (NOT between the range 1 -50)
Answer Posted / antony
#include<stdio.h>
void main()
{
int count=0;
int num=1;
int i;
printf("prime nums \n");
while(count<50)
{
num++;
for (i=2;i<=num-1;i)
{
if(num%i==0)break;
i++;
}
if(i>=num-1)
{
printf("%d ",num);
count++;
}
}
}
Is This Answer Correct ? | 93 Yes | 47 No |
Post New Answer View All Answers
What are the different types of control structures in programming?
What is the maximum no. of arguments that can be given in a command line in C.?
I came across some code that puts a (void) cast before each call to printf. Why?
write a programe to accept any two number and check the following condition using goto state ment.if a>b,print a & find whether it is even or odd and then print.and a
What is variable declaration and definition in c?
What is the advantage of an array over individual variables?
how much salary u want ? why u join in our company? your domain is core sector why u prefer software ?
Write a c program to build a heap method using Pointer to function and pointer to structure ?
What is hashing in c language?
in case any function return float value we must declare a) the function must be declared as 'float' in main() as well b) the function automatically returned float values c) function before declared 'float' keyword d) all the above
What does it mean when the linker says that _end is undefined?
What is character set?
Define Array of pointers.
Explain output of printf("Hello World"-'A'+'B'); ?
please explain clearly about execution of c program in detail,in which stage are the printf sacnf getting into exeecutable code