Write a C++ program to check whether a number is -ve or +ve and number is divisible by 5 and 11

Code:

#include<iostream>
using namespace std;
void main()
{
//check number is positive/negative & divisble by 5 & 11.
int num =0;
cout<<"Enter number:";
cin>>num;
if(num>0)
{
if( num%5==0 && num%11==0)
{
cout<<"Number is divisble by 5 & 11"<<endl;
}
else
cout<<"Number is not divisble by 5 & 11"<<endl;
}
else
{
cout<<"Number is Negative"<<endl;
}
system("pause");
}

Output:


Video:



Comments

Popular Posts