Write a program to print all the prime numbers with in the
given range
Answer Posted / pooja mishra
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int range,c;
cout<<"enter the range";
cin>>range;
for(int i=1;i<=range;i++)
{
c=0;
for(int j=2;j<i;j++)
{
if(i%j==0)
c++;
}
if(c==o)
cout<<i<<"\n";
}
getch();
}
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
Why clrscr is used in c?
What is the meaning of typedef struct in c?
hi send me sample aptitude papers of cts?
What is typedf?
What is binary tree in c?
What is #line used for?
What do you mean by command line argument?
What is nested structure?
What is c language and why we use it?
Is there a way to switch on strings?
Why static variable is used in c?
Explain what is output redirection?
Why we not create function inside function.
Explain what is a stream?
What is atoi and atof in c?