Advertisement
Guest User

Untitled

a guest
Sep 18th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. #include <iostream.h>
  2. #include <conio.h>
  3.  
  4. int Mayor(int A[],int n,int m)
  5. {
  6.     if(n==1)
  7.    {
  8.     return m;
  9.    }
  10.    else
  11.    {
  12.     if(m < A[n-1])
  13.       {
  14.         m = A[n-1];
  15.       }
  16.     return Mayor(A,n-1,m);
  17.    }
  18. }
  19.  
  20. void main(void)
  21. {
  22.     int n,A[20],m,may;
  23.    cout<<"HALLAR EL MAYOR NUMERO DEL ARREGLO"<<endl;
  24.    cout<<"----------------------------------"<<endl;
  25.    cout<<"Ingrese la cantidad de numeros: ";
  26.    cin>>n;
  27.    cout<<"Ingrese numeros: "<<endl;
  28.    for(int i=1;i<=n;i++)
  29.    {
  30.     cout<<"N."<<i<<": ";
  31.       cin>>A[i];
  32.    }
  33.    m=A[n];
  34.    may = Mayor(A,n,m);
  35.    cout<<"El mayor numero es: "<<may;
  36.    getch();
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement