Write a program to find whether the given number is prime or
not?
Answer Posted / sudha
#include<stdio.h>
#include<conio.h>
void main()
{
int isprime=1;
int n,i;
printf("enter a number");
scanf("%d",&n);
if(i=2;i<=n/2;i++)
{
if((n%i)==0)
{
isprime=0;
break;
}
}
if(isprime==1)
{
printf("%d is a prime number",n);
}
else
{
printf("%d is not a prime number",n);
}
getch();
}
Is This Answer Correct ? | 18 Yes | 5 No |
Post New Answer View All Answers
.find the output of the following program? char*myfunc(char*ptr) { ptr +=3; return (ptr); } int main() { char*x,*y; x="HELLO"; y=myfunc(x); printf("y = %s ",y); return 0; }
What is realloc in c?
illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question
Does c have enums?
Why are all header files not declared in every c program?
What is huge pointer in c?
Why pointers are used?
Are there namespaces in c?
What is the maximum length of an identifier?
Explain how do you list files in a directory?
What is "Hungarian Notation"?
What is const and volatile in c?
Is a house a shell structure?
What are high level languages like C and FORTRAN also known as?
What is the behavioral difference when include header file in double quotes (“”) and angular braces (<>)?