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
What is wrong with this initialization?
What is a const pointer in c?
What is a volatile keyword in c?
Why is c not oop?
what is the format specifier for printing a pointer value?
List some basic data types in c?
Explain About fork()?
Can i use “int” data type to store the value 32768? Why?
what is the difference between 123 and 0123 in c?
Explain 'far' and 'near' pointers in c.
write a program to create a sparse matrix using dynamic memory allocation.
What is c standard library?
will u please send me the placement papers to my mail???????????????????
What is modifier & how many types of modifiers available in c?
Explain modulus operator.