Friday, 5 July 2013

Write a program to accept a number and to find out whether the number is divisible by 5 or not.

#include<iostream>
using namespace std;
int main()
{
int num;
cout<<"Enter the number: ";
cin>>num;
if(num%5==0)
{
cout<<num<<" is divisible by 5.";
}
else
{
cout<<num<<" is NOT divisible by 5.";
}
}

No comments:

Post a Comment