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 are reserved words?
Using which language Test cases are added in .ptu file of RTRT unit testing???
What is the size of array float a(10)?
Where are the auto variables stored?
Explain how can you tell whether a program was compiled using c versus c++?
A c program to display count values from 0 to 100 and flash each digit for a secong.reset the counter after it reaches 100.use for loop,. pls guys hepl me.. :(
How can I get the current date or time of day in a c program?
In a switch statement, explain what will happen if a break statement is omitted?
#include
What is d scanf?
What do you mean by keywords in c?
What is external variable in c?
how to count no of words,characters,lines in a paragraph.
Explain the properties of union. What is the size of a union variable
What is the meaning of c in c language?