Program to Execute the Function Called zeroSmaller()
Write a function called zeroSmaller() that passes two integer arguments by reference and then sets the smaller of the two numbers to 0. Write a main() section of code to exercise this function.
Answers
Answered by
1
void zeroSmaller (int *m, int *n) {
if (*m > *n) *n = 0;
else *m = 0;
}
void main() {
int a = 8, b=1;
zeroSmaller(&a, &b) ;
}
if (*m > *n) *n = 0;
else *m = 0;
}
void main() {
int a = 8, b=1;
zeroSmaller(&a, &b) ;
}
Answered by
1
Answer:
#include<iostream>
using namespace std;
void zero_small(int &,int &);
int main()
{
int x,y;
cout<<"Enter first number : ";
cin>>x;
cout<<"Enter second number : ";
cin>>y;
zero_small(x,y);
cout<<"First number is : "<<x;
cout<<"\nSecond number is : "<<y
Similar questions