Hm.. I can't make my code work with the input of "2.5", but it works for "2,5" - do you use the wrong data type for my scanner? I have tried float and long also.. what else can I do?
package com.codegym.task.task04.task0416;
/*
Crossing the road blindly
*/
import java.util.Scanner;
public class Solution {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
double t = sc.nextDouble();
if (t % 5 == 0) {
System.out.println("green");
}
if (t % 5 == 2) {
System.out.println("yellow");
}
if (t % 5 == 1 ) {
System.out.println("red");
}
}
}