Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Program 1
- #include<iostream.h>
- #include<conio.h>
- void main()
- {
- clrscr();
- int maxarray(int a[],int n);
- int i,a[100],n,m;
- cout<<"Enter the number elements of an array"<<"\n";
- cin>>n;
- cout<<"Enter the array elements of array\n";
- for(i=0;i<n;i++)
- {cin>>a[i];
- }
- m = maxarray(a,n);
- cout<<"\nThe max is "<<m;
- getch();}
- int maxarray(int a[],int n)
- {
- int i,max;
- for(i=0;i<n;i++)
- { max=a[0];
- if(a[i]>=max)
- max=a[i];
- }
- return(max);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement