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 is pointer to pointer in c language?
What is the difference between class and object in c?
we called a function and passed something do it we have always passed the "values" of variables to the called function. such functions calles are called a) calls by reference b) calls by value c) calls by zero d) none of the above
What is sizeof array in c?
Between macros and functions,which is better to use and why?
What are the advantages of union?
What is register variable in c language?
Write a c program to demonstrate character and string constants?
Why flag is used in c?
How is = symbol different from == symbol in c programming?
How can I do peek and poke in c?
What are the advantage of c language?
Why is it that not all header files are declared in every C program?
c programs are converted into machine language with the help of a) an interpreter b) a compiler c) an operatinf system d) none of the above
What is the benefit of using const for declaring constants?