write the program for prime numbers?

Answer Posted / love

#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int num, i;
printf("enrer the value");
scanf("%d",&num);
i=2;
while(i<=num-1)
{
if(num%i==0)
{
printf("not a prime");
break;
}
i++;
}
if(i==num)
printf("prime");
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 is a pointer on a pointer in c programming language?

621


Is c call by value?

605


What does main () mean in c?

615


Create a structure to specify data on students given below: Roll number, Name, Department, Course, Year of joining Assume that there are not more than 450 students in the college. 1.write a function to print names of all students who joined in a particular year 2.write a function to print the data of a student whose roll number is given

2517


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

623






What is a keyword?

747


Is swift based on c?

638


What is the difference between strcpy() and memcpy() function in c programming?

626


What are the benefits of c language?

645


What is difference between union All statement and Union?

628


How can I rethow can I return a sequence of random numbers which dont repeat at all?

705


What is use of null pointer in c?

570


What is the difference between exit() and _exit() function?

606


What is the use of clrscr?

597


What is register variable in c language?

604