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 are enumerated types?
How can you convert integers to binary or hexadecimal?
What is substring in c?
Explain about block scope in c?
What is omp_num_threads?
How is a pointer variable declared?
What is an lvalue?
What is a lookup table in c?
What is #error and use of it?
Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create.
What is volatile variable in c with example?
How can you check to see whether a symbol is defined?
please give me some tips for the placement in the TCS.
How can I read a binary data file properly?
What is scope rule of function in c?