write the program for prime numbers?

Answer Posted / chetan mehra

#include<stdio.h>
#include<conio.h>

void main()
{
int x,y,z;
clrscr();
for(x=2; x<=50; x++)
{
for(y=2; y<x; y++)
{
if(x%y==0)
{
break;
}
}
if(x==y){
printf("%d\n",y);
}

}
getch();
}

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database.

1500


List the difference between a 'copy constructor' and a 'assignment operator' in C?

645


What is a memory leak? How to avoid it?

580


Explain about block scope in c?

664


What does the c in ctime mean?

573






what is the c source code for the below output? 10 10 10 10 10 10 10 10 10 10 9 9 7 6 6 6 6 6 6 9 7 5 9 7 3 2 2 5 9 7 3 1 5 9 7 3 5 9 7 4 4 4 4 5 9 7 8 8 8 8 8 8 8 8 9

1434


Explain what is the difference between null and nul?

664


hi friends how r u as soon in satyam my interview is start but i m very confusued ta wat i do plz help me frndz wat can i do plz tell me some question and answers related with "C" which r asked in the interview .

1906


Describe newline escape sequence with a sample program?

661


what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;

1892


Explain about C function prototype?

613


What does volatile do?

571


What is nested structure?

580


What is pivot in c?

570


What is the best way to comment out a section of code that contains comments?

786