Maximum Value

From Hack Wars Wiki

Jump to: navigation, search

Outdated and challenge answer, should be deleted. - aoi

Challenge Information for Maximum Value
Challenge Maximum Value
Code 4
Input Example 3,5,8,1,9 (Int)
Output Example 9 (Int)
Level 25
Profit $3,000
Experience 150 to each stat
Description Output the maximum value you are given.


Solution

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