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
How do we open a binary file in Read/Write mode in C?
What is difference between array and structure in c?
How reliable are floating-point comparisons?
What is getch() function?
What are file streams?
What is 1f in c?
What are two dimensional arrays alternatively called as?
Is it possible to pass an entire structure to functions?
How many keywords (reserve words) are in c?
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.
Explain the use of function toupper() with and example code?
write a program to rearrange the array such way that all even elements should come first and next come odd
Why c is called procedure oriented language?
Write a program to identify if a given binary tree is balanced or not.
What are the differences between new and malloc in C?