write the program for prime numbers?
Answer Posted / nandhini
#include<stdio.h>
int main()
{
int i,j,n,count=0;
printf("Enter the number:");
scanf("%d",&n);
for(i=2;i<=n;i++)
{
for(j=2;j<=i;j++)
{
if(i%j==0 && i/1==i)
{
count=count+1;
}
}
if(count==1)
{
printf("\n%d",i);
}
count=0;
}
}
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is??? please help me on this
What are the 4 types of unions?
Explain pointer. What are function pointers in C?
Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.
Why do some versions of toupper act strangely if given an upper-case letter?
What is sizeof in c?
how can f be used for both float and double arguments in printf? Are not they different types?
Write a code to generate a series where the next element is the sum of last k terms.
Why dont c comments nest?
Linked lists -- can you tell me how to check whether a linked list is circular?
what do u mean by Direct access files? then can u explain about Direct Access Files?
Where register variables are stored in c?
What does sizeof function do?
What is an auto keyword in c?
What is static memory allocation? Explain