Write a full program that find the remainder. Your solution should have a function named findRemainder that accepts two integer parameters and returns the remainder. Your main function should call the findRemainder function and assigns the return value to an int variable named remainder that is declared inside the main function. Your program should then print out the value stored in remainder. Submit the code and a copy of your output.
#include <iostream>
using namespace std;
int findRemainder(int number1,int number2){
return number1%number2;
}
int main(){
int number1;
int number2;
cout<<"Enter number 1: ";
cin>>number1;
cout<<"Enter number 2: ";
cin>>number2;
int remainder=findRemainder(number1,number2);
cout<<"Remainder: "<<remainder<<"\n\n";
cin>>number1;
return 0;
}
Comments
Leave a comment