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
Can you pass an entire structure to functions?
What is the translation phases used in c language?
What is a function simple definition?
is it possible to create your own header files?
What is a example of a variable?
using only #include
List some basic data types in c?
What is sizeof int?
Explain why c is faster than c++?
What are pointers in C? Give an example where to illustrate their significance.
What are pointers? Why are they used?
What is use of integral promotions in c?
Which is more efficient, a switch statement or an if else chain?
What is a ternary operator in c?
Which is best linux os?