Wednesday 1 June 2016

Write a program that accept two integers.Create a function that tells whether or not the first integer is multiple of second.

#include<iostream.h>
#include<conio.h>
void check_multiple(int n1, int n2);
void main()
{
       clrscr();
       int int1, int2;
       cout<<"Enter 1st integer: ";
       cin>>int1;
       cout<<"Enter 2nd Integer: ";
       cin>>int2;
       check_multiple(int1, int2);
       getch();
}
void check_multiple(int n1, int n2)
{
       if(n2 % n1 == 0)
              cout<<"First integer " <<n1<<" is the multiple of second integer "<<n2;
       else
              cout<<"First integer "<<n1<<" is not the multiple of second integer "<<n2;
}

Share:

0 comments:

Post a Comment

Popular Posts

Recent Posts

Unordered List

Text Widget

Pages

About Me

My photo
A group of two, with a little hope of helping beginners to learn how to code :)
Powered by Blogger.

Comments

Facebook

Ad Home

Follow Us

Random Posts

Sponsor

Recent Posts

Header Ads

Popular Posts

Copyright © Functions in C++ | Powered by Blogger

Design by ThemePacific | Blogger Theme by NewBloggerThemes.com | Distributed By Blogger Templates20