Integer type or not [closed]
- by kira
I am writing a program (in cpp) to check the primality of a given number
The point where i am struck is , I need to check in between the program wether the value i obtained upon some arithmetic operations on the input is an integer or not
i.e lets say input is 'a'
I want to know how to check if 'b' is integer or not (FYI, b=(a+1)/6 )
My attempt for this :
int main()
{
using std::cin;
using std::cout;
int b,c;
int a;
cout<<"enter the number";
cin>>a;
b=(a+1)/6;
c=(a-1)/6;
if (b is an integer)
cout << "The given number is prime";
else if (c is an integer)
cin << "The given number is prime!";
else
cout<<"The number is not prime";
return 0;
}