check whether a no is prime or not.

Answer Posted / paramjeet singh

#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int i,c;
printf("enter any number\n");
scanf("%d",&i);
printf("you have entered=%d\n",i);
for(c=2;c<=i-1;c++)
{
if(i%c==0)
printf("this no.is not a prime number");
}
printf("this is prime number");
getch();
}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain abstraction.

617


What is an object in c++?

614


Is there any difference between int [] a and int a [] in c++?

555


Is it possible to pass an object of the same class in place of object reference to the copy constructor?

569


What is diamond problem in c++?

542






If dog is a friend of boy, is boy a friend of dog?

574


What is the use of endl in c++ give an example?

615


How do you flush a buffer in c++?

601


What is operators in c++?

567


Do you know the use of vtable?

635


What are the advantages of using pointers in a program?

679


What is the advantage of c++ over c?

562


Which programming language is best?

551


Difference between strdup and strcpy?

649


What is the latest c++ version?

608