Maximum Value

From ElectronicWar

Jump to: navigation, search
Challenge Information for Maximum Value
Challenge Maximum Value
Code 4
Input Example 3,5,8,1,9
Output Example 9
Level 25
Profit $3000
Experience 150 to each stat
Description Output the maximum value you are given.


[edit] Solution

int numCount = getInputIntCount() - 1;
int max = getInputInt();
 
while(numCount > 0) {
    int next = getInputInt();
    if(next > max) {
        max = next;
    }
    numCount = numCount - 1;
}
 
setOutputInt(max);
Personal tools