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 does static variable mean?
What is the difference between array and linked list in c?
What is wrong with this statement? Myname = 'robin';
Describe the steps to insert data into a singly linked list.
Why we use int main and void main?
Explain how can you tell whether a program was compiled using c versus c++?
What is the 'named constructor idiom'?
Write a program to print fibonacci series using recursion?
What is structure padding in c?
Is c easier than java?
What does %c mean in c?
What is a buffer in c?
What are the types of data files?
a program that can input number of records and can view it again the record
What is the function of volatile in c language?