write the program for prime numbers?

Answer Posted / adhiyamaan

#include<stdio.h>
#include<conio.h>
{
int num,i;
printf("enter the number:");
scanf("%d",&num);
for(i=2;i<=num-1;i++)
{
if(num%i==0)
{
printf("NOT PRIME");
break;
}
}
if(i==num)
{
printf("PRIME");
}
getch();
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the different types of errors?

646


What is define c?

574


What is auto keyword in c?

792


what is the structure pointer?

1644


Is c still relevant?

639






What is use of null pointer in c?

570


What is the collection of communication lines and routers called?

614


What is .obj file in c?

648


What are the modifiers available in c programming language?

740


List at least 10 sorting methods indicating their average case complexity, worst case complexity and best case complexity.

2303


How pointer is different from array?

579


Explain how do you determine the length of a string value that was stored in a variable?

670


How can you read a directory in a C program?

651


What is the meaning of ?

620


What is the benefit of using #define to declare a constant?

607