In this post, we will learn** how to check if a number is divisible by 5 and 11 or not using C++** Programming language.

This program asks the user to enter an integer, then this program checks whether the number is divisible by both** 5** and **11** using **&&** operator.

So, without further ado, letâ€™s begin this tutorial.

**C++ Program to Check If a Number is Divisible by 5 and 11**

// C Program to Check If a Number is Divisible by 5 and 11 #include <iostream> using namespace std; int main(){ int num; // Asking for input cout << "Enter any integer: "; cin >> num; // Checking divisibility if ((num % 5 == 0) && (num % 11 == 0)){ cout << num << " is divisible by 5 and 11."; } else { cout << num << " is not divisible by 5 and 11."; } return 0; }

**Output 1**

```
Enter any integer: 110
110 is divisible by 5 and 11.
```

**Output 2**

```
Enter any integer: 120
120 is not divisible by 5 and 11.
```

**How Does This Program Work ?**

int num;

In this program, we have declared an** int data type** variable named **num**.

// Asking for input cout << "Enter any integer: "; cin >> num;

Then, the user is asked to enter an integer. The value of this integer get stored in **num** named variable.

// Checking divisibility if ((num % 5 == 0) && (num % 11 == 0)){ cout << num << " is divisible by 5 and 11."; } else { cout << num << " is not divisible by 5 and 11."; }

Then, we check whether the number is divisible by** 5 and 11 **or not using **&&** operator.

**Conclusion**

I hope after going through this post, you understand **how to check if a number is divisible by 5 and 11 or not using C++** Programming language..

If you have any problem regarding the program, feel free to contact us in the comment section. We will be delighted to guide you.

**Also Read:**