write the program for prime numbers?
Answer Posted / umesh prajapati
/* find the number is prime or not prime. umesh prajapati*/
#include<stdio.h>
#include<conio.h>
void main()
{
int n,c,r;
clrscr();
printf("ENTER THE VALUE");
scanf("%d",&n);
if(n==2)
printf("THE NUMBER IS CO-PRIME");
else
{
c=2;
while(c<n)
{
r=n%c;
if(r==0)
{
printf("GIVEN NUMBER IS NOT PRIME");
break;
}
c++;
}
if(r>0)
printf("GIVEN NUMBER IS PRIME");
}
getch();
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is scope of variable in c?
Why clrscr is used after variable declaration?
Given a valid 24 hour format time find the combination of the value and write a program ,do not hard the value and if any other inputs provided should work with the logic implemented Input: 11:30 Output: 13:10 Input: 18:25 Output: 21:58
List at least 10 sorting methods indicating their average case complexity, worst case complexity and best case complexity.
Explain what is the advantage of a random access file?
What is return type in c?
What is structure in c language?
What do mean by network ?
What is the use of a ‘ ’ character?
How do I use strcmp?
Explain how do you determine whether to use a stream function or a low-level function?
Write a program to swap two numbers without using third variable?
What is the argument of a function in c?
What is calloc malloc realloc in c?
WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?