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


Please Help Members By Posting Answers For Below Questions

What are the different types of control structures in programming?

878


What is the maximum no. of arguments that can be given in a command line in C.?

887


I came across some code that puts a (void) cast before each call to printf. Why?

959


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

1658


What is variable declaration and definition in c?

689


What is the advantage of an array over individual variables?

978


how much salary u want ? why u join in our company? your domain is core sector why u prefer software ?

1727


Write a c program to build a heap method using Pointer to function and pointer to structure ?

4394


What is hashing in c language?

838


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

803


What does it mean when the linker says that _end is undefined?

855


What is character set?

901


Define Array of pointers.

827


Explain output of printf("Hello World"-'A'+'B'); ?

1174


please explain clearly about execution of c program in detail,in which stage are the printf sacnf getting into exeecutable code

1911