This blog consists of C and C++ programs. C and C++ programming is the basics to learn any programming language. Most of the programs are provided with their respective outputs. This blog also contains Data Structures programs using Object-Oriented Programming (C++). Some of the best books for learning C and C++ programming are also mentioned.

Monday 3 June 2013

Program to check whether a number is Prime number or not

#include<iostream.h>
#include<conio.h>
void main()
{
int n;
clrscr();
cout<<"Enter the number:";
cin>>n;
int x=n*n;
int y=x+17;
int z=y%12;
if(z==6)
{
cout<<"Prime Number";
}
else
{
cout<<"Not a Prime Number";
}
getch();
}


No comments:

Post a Comment