write the program for prime numbers?
Answer Posted / noble
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("enter any number:");
scanf("%d",&a);
for(b=2;b<=a-1;b++)
{
if(a%b==0)
break;
}
if(a==b)
{
printf("%d is prime number",a);
}
else
{
printf("%d is not prime number",a);
}
getch();
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What’s the special use of UNIONS?
Find the second largest element in an array with minimum no of comparisons and give the minimum no of comparisons needed on an array of size N to do the same.
How do you generate random numbers in C?
difference between native and cross compilers
what is a NULL Pointer? Whether it is same as an uninitialized pointer?
Why & is used in scanf in c?
What is a shell structure examples?
how to create duplicate link list using C???
What is pointers in c?
Who invented bcpl language?
How do you override a defined macro?
Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.
What are the advantages of c language?
Why is extern used in c?
Can I initialize unions?