write the program for prime numbers?

Answer Posted / karthika

#include<stdio.h>
#include<conio.h>
void main()
{
int num,i=2;
clrscr();
printf("\n entert a number");
scanf("%d",&num);
while(c<=num-1)
{
if(num%i==0)
{
printf("given number is not a prime number\n");
break;
}
i++;
}
if(i==num);
printf(given number is a prime number\n");
getch();
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are enumerations in C

933


What are the usage of pointer in c?

924


What is getch () for?

895


What are the different types of linkage exist in c?

799


Where are local variables stored in c?

779


what is a NULL Pointer? Whether it is same as an uninitialized pointer?

1039


How can I sort more data than will fit in memory?

892


How can I get random integers in a certain range?

806


What are the disadvantages of c language?

882


simple program of graphics and their output display

1720


Is main a keyword in c?

845


What is difference between Structure and Unions?

884


What is nested structure with example?

831


Describe the difference between = and == symbols in c programming?

1024


When is a “switch” statement preferable over an “if” statement?

876