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
Why do we use return in c?
Explain what does the function toupper() do?
What is the equivalent code of the following statement in WHILE LOOP format?
What are the advantages of external class?
how to print the character with maximum occurence and print that number of occurence too in a string given ?
Can we replace the struct function in tree syntax with a union?
Is calloc better than malloc?
What is the difference between if else and switchstatement
What is build process in c?
What is the difference between arrays and pointers?
What is the use of getchar functions?
What are linker error?
What is the meaning of ?
Can you tell me how to check whether a linked list is circular?
What is the auto keyword good for?