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
Explain what is the benefit of using const for declaring constants?
How would you rename a function in C?
Can a local variable be volatile in c?
Can you mix old-style and new-style function syntax?
console I/O functions means a) the I/O operations done on disk b) the I/O operations done in all parts c) the input given through keyboard is displayed VDU screen d) none of the above
Is it possible to initialize a variable at the time it was declared?
What language is c written?
Describe the modifier in c?
What is a program?
Differentiate between a structure and a union.
PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE
Explain high-order bytes.
Explain null pointer.
What are c preprocessors?
How can I check whether a file exists? I want to warn the user if a requested input file is missing.