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
a program that performs some preliminary processing in C, it acts upon certain directives that will affect how the compiler does its work a) compiler b) loader c) directive d) preprocessor
What are the features of c languages?
What is the difference between formatted&unformatted i/o functions?
the statement while(i) puts the entire logic in loop. this loop is called a) indefinite loop b) definite loop c) loop syntax wrong d) none of the above
What is a class c rental property?
How would you use the functions fseek(), freed(), fwrite() and ftell()?
What is identifiers in c with examples?
What is conio h in c?
What are the types of macro formats?
Why is c called c not d or e?
What is "Hungarian Notation"?
What functions are used in dynamic memory allocation in c?
How can you pass an array to a function by value?
What are pointers? Why are they used?
What does double pointer mean in c?