write the program for prime numbers?
Answer Posted / ashok
void main()
{
int i,n;
clrscr();
printf("\nEnter the range:");
scanf("%d",&n)
printf("Prime numbers are:");
for(i=1;i<=n;i++)
{
if(i==2 || i==3 || i==5 || i==7)
printf("%d ",i);
if(i%2!=0 && i%3!=0 && i%5!=0 && i%7!=0)
printf("%d ",i);
}
getch();
}
| Is This Answer Correct ? | 7 Yes | 8 No |
Post New Answer View All Answers
Differentiate between Macro and ordinary definition.
What are local static variables?
What is the use of a static variable in c?
What is the correct declaration of main?
What does sizeof int return?
Difference between constant pointer and pointer to a constant.
What does the function toupper() do?
If the size of int data type is two bytes, what is the range of signed int data type?
What is calloc in c?
What is null in c?
How macro execution is faster than function ?
What is the process to create increment and decrement stamen in c?
What is ponter?
Why c is called a middle level language?
Explain why c is faster than c++?