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
Why dont c comments nest?
Why doesnt long int work?
What is keyword in c?
Write a program to generate the Fibinocci Series
What is the use of void pointer and null pointer in c language?
What are the types of data structures in c?
What is string function c?
What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?
What are the features of c languages?
How does struct work in c?
in any language the sound structure of that language depends on its a) character set, input/output function, its control structures b) character set, library functions, input/output functions its control structures c) character set, library functions, control sturctures d) character set, operators, its control structures
Write a code to generate divisors of an integer?
What is pointer to pointer in c language?
Did c have any year 2000 problems?
What is the use of a static variable in c?