write the program for prime numbers?
Answer Posted / karthik
#include<stdio.h>
#include<conio.h>
void main()
{
int n,c=0,i;
clrscr();
printf("enter any number");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
if(n%i==0)
c++;
}
(c==2)? printf("%d is a prime number",n):
printf("%d is not a prime number",n);
getch();
}
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is the use of ?
What is NULL pointer?
Explain 'bit masking'?
what are the facialities provided by you after the selection of the student.
How can I generate floating-point random numbers?
Which one would you prefer - a macro or a function?
Explain 'bus error'?
What are the functions to open and close file in c language?
What is the condition that is applied with ?: Operator?
How do you define structure?
How would you rename a function in C?
#include main() { enum _tag{ left=10, right, front=100, back}; printf("left is %d, right is %d, front is %d, back is %d",left,right,front,back); }
Why do we write return 0 in c?
What is null in c?
What are the 5 types of organizational structures?