package com.codegym.task.task04.task0419;
/*
Maximum of four numbers
*/
import java.io.*;
import java.util.Scanner;
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
Scanner in = new Scanner(System.in);
int fnum =1;
int snum =1;
int tnum =1;
int fonum =2;
int temp=0;
int arr[]={fnum,snum,tnum,fonum};
for(int i=0; i<arr.length;i++){
if(arr[i]>temp){ temp=arr[i];
}} System.out.println(temp);
}
}
Kazer Panol
Level 7
Whats wrong with my code?Please help
Under discussion
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
Kazer Panol
8 May 2020, 10:13
Thanks it works correctly.
0
Ashish RajAnand
8 May 2020, 00:50
1-Where you take input from keyword .
2-you must assign first number to temp variable to work correct with negative number .
+2