/*
program to check entered number is prime or composite....
*/
#include<iostream.h>
#include<conio.h>
void main()
{
int n,i=2,a=0;
clrscr();
cout<<"Enter th number=";
cin>>n;
for(;i<n;i++)
{
if(n%i==0)
a=1;
break;
}
if(a==0)
cout<<"Entered no. is prime";
else
cout<<"Entered no.is composite";
getch();
}
0 comments:
Post a Comment