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 does %2f mean in c?
i have to apply for rbi before that i need to know the the syllabus for the entrance questions. whethet it may be aps or techinical
How to explain the final year project as a fresher please answer with sample project
A float occupies 4 bytes in memory. How many bits are used to store exponent part? since we can have up to 38 number for exponent so 2 ki power 6 6, 6 bits will be used. If 6 bits are used why do not we have up to 64 numbers in exponent?
Why do we use header files in c?
When a c file is executed there are many files that are automatically opened what are they files?
What is variable declaration and definition in c?
What is an array in c?
What is chain pointer in c?
What is advantage of pointer in c?
Why c is called top down?
Write a program to know whether the input number is an armstrong number.
Explain the difference between call by value and call by reference in c language?
write a program to rearrange the array such way that all even elements should come first and next come odd
What is calloc() function?