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
What is c value paradox explain?
Does c have function or method?
can we change the default calling convention in c if yes than how.........?
What is c++ used for today?
Write a program to generate random numbers in c?
What are the types of i/o functions?
Is exit(status) truly equivalent to returning the same status from main?
What is merge sort in c?
What is non linear data structure in c?
what is the difference between class and unio?
write a program using linked list in which each node consists of following information. Name[30] Branch Rollno Telephone no i) Write the program to add information of students in linked list
What is the use of ?: Operator?
main() { printf("hello"); fork(); }
What do you mean by recursion in c?
What are predefined functions in c?