Sunday 15 June 2014

C++ program to check whether the given number is divisible by another number



Here is a C++ program to check whether the given number N is divisible by M


 SOURCE CODE OUTPUT
#include<iostream>
using namespace std;
int main()
{
    int a,b;
    cout<<"Enter the first number ";
    cin>>a;

    cout<<"Enter the second number ";
    cin>>b;
    if(a%b==0)
        cout<<a<<" is divisible by "<<b;
    else
        cout<<"The number is not divisible";
    return 0;
}

Any questions regarding to program please write in comments.

No comments:

Post a Comment