Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream.h>
- #include <conio.h>
- int Mayor(int A[],int n,int m)
- {
- if(n==1)
- {
- return m;
- }
- else
- {
- if(m < A[n-1])
- {
- m = A[n-1];
- }
- return Mayor(A,n-1,m);
- }
- }
- void main(void)
- {
- int n,A[20],m,may;
- cout<<"HALLAR EL MAYOR NUMERO DEL ARREGLO"<<endl;
- cout<<"----------------------------------"<<endl;
- cout<<"Ingrese la cantidad de numeros: ";
- cin>>n;
- cout<<"Ingrese numeros: "<<endl;
- for(int i=1;i<=n;i++)
- {
- cout<<"N."<<i<<": ";
- cin>>A[i];
- }
- m=A[n];
- may = Mayor(A,n,m);
- cout<<"El mayor numero es: "<<may;
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement