write the program for prime numbers?
Answer Posted / arafat buet
#include<stdio.h>
int main()
{
int i,n,r;
printf("enter any number:");
scanf("%d",&n);
if(n==1)
printf("not prime\n");
for(i=2;i<n;i++)
{
r=n%2;
if(r==0)
{
printf("\nnot prime\n");
break;
}
}
if(i==n)
printf("prime\n");
return 0;
}
Is This Answer Correct ? | 24 Yes | 19 No |
Post New Answer View All Answers
write a c program to print the next of a particular no without using the arithmetic operator or looping statements?
Define Spanning-Tree Protocol (STP)
Explain bitwise shift operators?
process by which one bit patten in to another by bit wise operation is? (a) masking, (b) pruning, (c) biting, (d) chopping,
What is 02d in c?
How main function is called in c?
my project name is adulteration of chille powder.how can i explain it to the hr when he asks me about the project?
How do you generate random numbers in C?
How do I send escape sequences to control a terminal or other device?
What is wild pointer in c?
Can you apply link and association interchangeably?
How can I invoke another program (a standalone executable, or an operating system command) from within a c program?
Is flag a keyword in c?
how can i write a program that prints out a box such that whenever i press any key8(coordinate number) on the keyboard, the box moves.
Explain why can’t constant values be used to define an array’s initial size?