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
What are the types of data structures in c?
Explain why c is faster than c++?
4. main() { int c=- -2; printf("c=%d",c); }
Explain the difference between malloc() and calloc() in c?
Disadvantages of C language.
What is a struct c#?
what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;
What is merge sort in c?
a program that can input number of records and can view it again the record
What would be an example of a structure analogous to structure c?
What does a pointer variable always consist of?
What is identifier in c?
What are the features of c languages?
What is a pointer in c plus plus?
Write the syntax and purpose of a switch statement in C.