Write a program to find whether the given number is prime or
not?
Answer Posted / md.ershad ezaz
#include<stdio.h>
#include<conio.h>
void main()
{
int i,n,c;
clrscr();
printf("Enter a number\n");
scanf("%d",&n);
c=0;
for(i=1;i<=n;i++)
{
if(n%i==0)
c=c+1;
}
if(c==2)
printf("%d is prime",n);
else
printf("%d is not prime",n);
getch();
}
Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
What is define c?
What is a built-in function in C?
Why is c faster?
What is a pragma?
What is struct node in c?
why return type of main is not necessary in linux
Which header file is essential for using strcmp function?
What are multidimensional arrays?
Explain the difference between exit() and _exit() function?
Explain what is #line used for?
Can include files be nested? How many levels deep can include files be nested?
How does selection sort work in c?
Explain how can I right-justify a string?
What was noalias and what ever happened to it?
What is the best style for code layout in c?