how to find the given number is prime or not?
Answer Posted / arunkumar mt
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int i,n,flag=0;
clrscr();
printf("enter a number\n");
scanf("%d",&n);
for(i=2;i<=sqrt(n);i++)
{
if(n%i==0)
{
flag=1;
break;
}
}
if(flag==0)
{
printf("given number %d is prime",n);
}
else
{
printf("given number %d is not prime",n);
}
getch();
}
| Is This Answer Correct ? | 2 Yes | 3 No |
Post New Answer View All Answers
if p is a string contained in a string?
Is c dynamically typed?
which of the following statement is wrong a) mes=123.56; b) con='T'*'A'; c) this='T'*20; d) 3+a=b;
What is typedf?
what type of questions arrive in interview over c programming?
which type of aspect you want from the student.
Explain spaghetti programming?
What is the difference between volatile and const volatile?
A c program to display count values from 0 to 100 and flash each digit for a secong.reset the counter after it reaches 100.use for loop,. pls guys hepl me.. :(
What is the correct declaration of main?
Is c still used?
Why is c still so popular?
What is the explanation for the dangling pointer in c?
Difference between MAC vs. IP Addressing
How will you declare an array of three function pointers where each function receives two ints and returns a float?