C++ Program to Check Number is Divisible by 5 And 11

Write a C++ Program to Check Number is Divisible by 5 And 11 with an example. This C++ program to find number divisible by 5 And 11 allows us to enter any numeric value. Next, we used the If statement to check whether the given number divisible 5 and 11 equals 0. Based on the output, it prints the result.

#include<iostream>
using namespace std;

int main()
{
	int number;
	
	cout << "\nEnter any Number to Check it is Divisible by 5 and 11 =  ";
	cin >> number;
	
	if(( number % 5 == 0 ) && ( number % 11 == 0 ))
	{
		cout << "\nGiven number "<< number << " is Divisible by 5 and 11";
	}
	else
	{
		cout << "\nGiven number "<< number << " is Not Divisible by 5 and 11";
	}
		
 	return 0;
}
C++ Program to Check Number is Divisible by 5 And 11 1

C++ Program to Check Number is Divisible by 5 And 11 using Conditional Operator

#include<iostream>
using namespace std;

int main()
{
	int number;
	
	cout << "\nEnter any Number to Check it is Divisible by 5 and 11 =  ";
	cin >> number;
	
	((number % 5 == 0 ) && ( number % 11 == 0 )) ? 
		cout << "\nGiven number "<< number << " is Divisible by 5 and 11" :
		cout << "\nGiven number "<< number << " is Not Divisible by 5 and 11";
		
 	return 0;
}
Enter any Number to Check it is Divisible by 5 and 11 =  75

Given number 75 is Not Divisible by 5 and 11

number = 55

Enter any Number to Check it is Divisible by 5 and 11 =  55

Given number 55 is Divisible by 5 and 11