Write a program to find whether the given number is prime or
not?
Answer Posted / padhmavathi loganathan
#include<stdio.h>
int main()
{
int a,i,f;
printf("Enter a number: ");
scanf("%d",&a);
f=0;
i=2;
while(i <= a/2)
{
if(a%i == 0)
{
f=1;
break;
}
i++;
}
if(f==0)
printf("Prime Number")
else
printf("Not Prime Number");
return 0;
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is break in c?
How many levels of pointers can you have?
What is a #include preprocessor?
Can a pointer be static?
What are actual arguments?
Are there constructors in c?
When I set a float variable to, say, 3.1, why is printf printing it as 3.0999999?
Write a C program to count the number of email on text
explain what are actual arguments?
Explain do array subscripts always start with zero?
what are enumerations in C
which is conditional construct a) if statement b) switch statement c) while/for d) goto
Why is it usually a bad idea to use gets()? Suggest a workaround.
Explain setjmp()?
Explain what are compound statements?