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
What is stack in c?
What is unary operator?
Why we use stdio h in c?
what are the advantages of a macro over a function?
how to make a scientific calculater ?
How does sizeof know array size?
What is a sequential access file?
how can I convert a string to a number?
If errno contains a nonzero number, is there an error?
An instruction which is analysed and acted upon by the processor prior to the compiler going its work a) directive b) constructive c) constant d) absolute mode
how to print the character with maximum occurence and print that number of occurence too in a string given ?
What is difference between union and structure in c?
What is pivot in c?
which of the following is not a character constant a) 'thank you' b) 'enter values of p, n ,r' c) '23.56E-o3' d) all of the above
What are linked lists in c?