Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int n,nmax=-9999999, nmin=9999999;
- void getMin(int n){
- if(n<nmin && n!=0){nmin=n;}
- }
- void getMax(int n){
- if(n>nmax && n!=0){nmax=n;}
- }
- void enterNum(){
- cin >> n;
- getMin(n);
- getMax(n);
- while(n!=0){
- enterNum();
- }
- }
- int main(){
- enterNum();
- cout << "Min: " << nmin << endl;
- cout << "Max: " << nmax << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement