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
What is modifier & how many types of modifiers available in c?
Why is c called a mid-level programming language?
In C programming, how do you insert quote characters (‘ and “) into the output screen?
What is function prototype in c with example?
Describe dynamic data structure in c programming language?
What is a #include preprocessor?
WRITE A CODE IN C TO SEARCH A FILE FROM NOTEPAD FILE.
What are different types of variables in c?
Explain about the functions strcat() and strcmp()?
#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); }
What are the two types of structure?
What are the 5 data types?
Explain union.
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?
How is pointer initialized in c?