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 does p mean in physics?
Why do we use main function?
Is there a way to jump out of a function or functions?
Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.
How is a null pointer different from a dangling pointer?
explain what is an endless loop?
What is the use of function overloading in C?
What is a dynamic array in c?
What is a void pointer in c?
Tell me can the size of an array be declared at runtime?
What is c language in simple words?
Why are some ANSI/ISO Standard library routines showing up as undefined, even though I've got an ANSI compiler?
Can true be a variable name in c?
What do you mean by c what are the main characteristics of c language?
What are the properties of union in c?