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

How is a macro different from a function?

654


What is #define size in c?

644


Can a function argument have default value?

672


Is fortran still used in 2018?

595


Is it cc or c in a letter?

563






main() { printf("hello"); fork(); }

695


What are the advantages of c language?

664


How can a process change an environment variable in its caller?

653


What is a protocol in c?

558


Explain the use of #pragma exit?

699


Why is c used in embedded systems?

611


Write a program to print numbers from 1 to 100 without using loop in c?

638


What's the total generic pointer type?

614


What are directives in c?

544


Describe the difference between = and == symbols in c programming?

775