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
write a program in C that prompts the user for today's date,tomorrow's date and display the results.Use structures for today's date,tomorrow's date and an array to hold the days for each month of the year.
What are linker error?
What is the use of getchar functions?
How can I ensure that integer arithmetic doesnt overflow?
differentiate built-in functions and user – defined functions.
how do you execute a c program in unix.
Explain output of printf("Hello World"-'A'+'B'); ?
When do you not use the keyword 'return' when defining a function a) Always b) Never c) When the function returns void d) dfd
Here is a neat trick for checking whether two strings are equal
Explain the meaning of keyword 'extern' in a function declaration.
What is a pointer on a pointer in c programming language?
What is the use of function overloading in C?
diff between exptected result and requirement?
What are the disadvantages of a shell structure?
Is javascript written in c?