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


Please Help Members By Posting Answers For Below Questions

provide an example of the Group by clause, when would you use this clause

1707


What is the difference between declaring a variable and defining a variable?

723


What are the storage classes in C?

621


What are local variables c?

549


What is 1d array in c?

600






What is the difference between NULL and NUL?

726


Which is an example of a structural homology?

785


Tell me what are bitwise shift operators?

656


Give differences between - new and malloc() , delete and free() ?

610


What is the most efficient way to store flag values?

687


Why n++ execute faster than n+1 ?

1846


What are dangling pointers? How are dangling pointers different from memory leaks?

621


What is pre-emptive data structure and explain it with example?

3210


Explain what is wrong with this statement? Myname = ?robin?;

1016


What is the purpose of ftell?

599