+ 2

what should be typed in blanks to get largest element of the array of 10 elements?

https://code.sololearn.com/cPu51mTOd6Uz/?ref=app

3rd Apr 2017, 11:48 AM
Dhananjay Panage
Dhananjay Panage - avatar
2 Antworten
+ 4
"x" and "max" are the answers. That "if" statement works as follows. If a number is greater than the current maximum, make it maximum.
3rd Apr 2017, 1:01 PM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 2
#include <iostream> using namespace std; int main() { int arr [10]; for(int x=0;x<10;x++) { cin>>arr [x]; } int max = arr[0]; for(int x=0;x<10;x++) { if (arr[x]>max) max=arr[x]; } cout << max; }
3rd Apr 2017, 12:02 PM
देवेंद्र महाजन (Devender)
देवेंद्र महाजन (Devender) - avatar