Check multiple of 5 in C++
if else - Question 5
In this question, we will see how to check if a number is a multiple of 5 or not in C++ programming using the if else statement. To know more about if else statement click on the if else statement lesson.
Q5) Write a program in C++ to input any number and check if it is multiple of 5 or not. A number is multiple of 5 if it is divisible by 5.
Program
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int n;
cout<<"Enter a number ";
cin>>n;
if(n%5==0)
{
cout<<"Multiple of 5";
}
else
{
cout<<"Not Multiple of 5";
}
return 0;
}
Output
Enter a number 10 Multiple of 5