daily pastebin goal


a guest Jan 22nd, 2018 48 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
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand