Write a program to find whether the given number is prime or
not?
Answer Posted / nikhilreddy gujjula
#include<stdio.h>
#include<conio.h>
void main()
{
int prime=1;
int n,i;
printf("enter a number");
scanf("%d",&n);
if(i=2;i<=n/2;i++)
{
if((n%i)==0)
{
prime=0;
break;
}
}
if(prime==1)
{
printf("%d is a prime number",n);
}
else
{
printf("%d is not a prime number",n);
}
getch();
}
Is This Answer Correct ? | 5 Yes | 5 No |
Post New Answer View All Answers
Write the Program to reverse a string using pointers.
a c code by using memory allocation for add ,multiply of sprase matrixes
Why is #define used?
Explain what is the difference between null and nul?
Why string is used in c?
Explain which of the following operators is incorrect and why? ( >=, <=, <>, ==)
what is the role you expect in software industry?
Why is python slower than c?
Explain what is the purpose of "extern" keyword in a function declaration?
What is volatile variable how do you declare it?
What is local and global variable in c?
while initialization of array why we use a[][2] why not a[2][]...?
what are non standard function in c
What is #include stdio h?
hi, which software companys will take,if d candidate's % is jst 55%?