daily pastebin goal
73%
SHARE
TWEET

Untitled

a guest Jan 22nd, 2018 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3. int max(int a,int b) {if (a>b) return a; else return max(b,a);}
  4. int min(int a,int b) {if (a<b) return b; else return min(b,a);}
  5. int main()
  6. {
  7.     int a,b,x,y,n,i;
  8.     cout<<"n= "; cin>>n; cout<<"numar= "; cin>>a; x=a; y=a;
  9.     for (i=2;i<=n;i++)
  10.     {
  11.         cout<<"numar= "; cin>>a; x=max(x,a); y=min(x,a);}
  12.         cout<<"maxim= "<<x<<endl<<"minim= "<<y;}
RAW Paste Data
Top