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
Between macros and functions,which is better to use and why?
if the area was hit by a virus and so the decrease in the population because of death was x/3 and the migration from other places increased a population by 2x then annually it had so many ppl. find our the population in the starting.
Explain how can I remove the trailing spaces from a string?
What are the advantages of c language?
What are the loops in c?
How do I send escape sequences to control a terminal or other device?
How to declare a variable?
hw can we delete an internal node of binary search tree the internal node has child node..plz write progarm
What is page thrashing?
There is a practice in coding to keep some code blocks in comment symbols than delete it when debugging. How this affect when debugging?
Why c is called free form language?
Can we declare variable anywhere in c?
Difference between Function to pointer and pointer to function
Study the following C program :call_me (myvar)int myvar;{ myvar +- 5; }main(){int myvar;myvar = 3;call_me(myvar);printf("%d ",myvar);What will be printed a) 3 b) 5 c) 8 d) symbol
Differentiate between a for loop and a while loop? What are it uses?