write the program for prime numbers?
Answer Posted / kiran
#include<iostream>
#include<stdio.h>
#include<conio.h>
using namespace std;
int main()
{
int tn=1,c=0,flag=0;;
cin>>tn;
for(int i=3; c!=tn;i++)
{for(int j=2;j<i;j++)
{
if(i%j==0){
flag=0; break;}
else flag=1;
}
if(flag)
{c++;
printf("%d,",i);
}
}
getch();
return 0;
}
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
Is null always equal to 0(zero)?
explain what are actual arguments?
What is the purpose of scanf() and printf() functions?
What does the function toupper() do?
Where is volatile variable stored?
Explain what are binary trees?
What are register variables in c?
What is void c?
What type is sizeof?
What is the use of pointers in C?
the portion of a computer program within which the definition of the variable remains unchanged a) mode b) module c) scope d) none
What is c programming structure?
What are the differences between Structures and Arrays?
what do u mean by Direct access files? then can u explain about Direct Access Files?
Where register variables are stored in c?