write the program for prime numbers?

Answer Posted / paartha

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

void main()
{
int a,i , b,flag=0,no;
clrscr();

for(no=2;no<100;no++)
{
for(i=2;i<no;i++)
{
b=no%i;
if(b==0)
{
flag=1;
break;
}
else
{
flag=0;
}
}
if(flag!=1)
{
printf("\n%d",no);
}
}

getch();
}

Is This Answer Correct ?    7 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is modifier & how many types of modifiers available in c?

614


Why is c called a mid-level programming language?

733


In C programming, how do you insert quote characters (‘ and “) into the output screen?

899


What is function prototype in c with example?

583


Describe dynamic data structure in c programming language?

610






What is a #include preprocessor?

624


WRITE A CODE IN C TO SEARCH A FILE FROM NOTEPAD FILE.

2031


What are different types of variables in c?

573


Explain about the functions strcat() and strcmp()?

602


#define PRINT(int) printf("int = %d ",int) main() {< BR> intx,y,z; x=03;y=02;z=01; PRINT(x^x); z<<=3;PRINT(x); y>>=3;PRINT(y); }

724


What are the two types of structure?

581


What are the 5 data types?

607


Explain union.

641


What is the right type to use for boolean values in c? Is there a standard type? Should I use #defines or enums for the true and false values?

610


How is pointer initialized in c?

591