In: Computer Science
#include<iostream> using namespace std; int findMin(int i, int j, int k){ if(i<=j && i<=k){ return i; } else if(j<=k){ return j; } else{ return k; } } int findMax(int i, int j, int k){ if(i>=j && i>=k){ return i; } else if(j>=k){ return j; } else{ return k; } } int main() { int min, max, i, j, k; cout<<"Enter first integer: "; cin>>i; cout<<"Enter second integer: "; cin>>j; cout<<"Enter third integer: "; cin>>k; min = findMin(i,j,k); max = findMax(i,j,k); cout<<"Largest: "<<max<<endl; cout<<"Smallest: "<<min<<endl; return 0; }