write the program for prime numbers?
Answer Posted / karthik
#include<stdio.h>
#include<conio.h>
void main()
{
int n,flag;
clrscr();
printf("\n Enter prime no\n");
scanf("%d",&n);
for(int i=2;i<=n/2;i++)
{
if(n%i==0)
{
flag=0;
break;
}
}
if(flag==0)
printf("\n%d is not prime",n);
else
printf("\n %d is prime",n);
getch();
}
| Is This Answer Correct ? | 21 Yes | 17 No |
Post New Answer View All Answers
Explain what is the advantage of a random access file?
Explain what is the difference between a string and an array?
How does pointer work in c?
Is swift based on c?
Is there a way to compare two structure variables?
What does dm mean sexually?
Is it possible to pass an entire structure to functions?
Tell us two differences between new () and malloc ()?
Do array subscripts always start with zero?
What is function prototype in c with example?
What is the behavioral difference when include header file in double quotes (“”) and angular braces (<>)?
What is this infamous null pointer, anyway?
If the size of int data type is two bytes, what is the range of signed int data type?
shorting algorithmS
What is mean by data types in c?