Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int arr[]={10,15,97,19,109};
- int max = INT16_MIN;
- for(int i=0;i<5;i++)
- {
- if(arr[i]>max) //We can also use another array to do the same thing.
- {
- max=arr[i];
- arr[i]=max;
- }
- else
- {
- arr[i]=max;
- }
- cout<<arr[i]<<endl;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment