0
Java error
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int math = scanner.nextInt(); int history = scanner.nextInt(); int geometry = scanner.nextInt(); int vse=math+history+geometry; int chas = vse/60,min=vse%60; System.out.println(chas,min); //ваш код } }
12 Answers
+ 1
println() takes 1 parameter, aside from that the task description asks us to print in 2 lines
https://www.geeksforgeeks.org/system-out-println-in-java/
If you wanted to print it in 1 line, you would need to concatenate the outputs
+ 1
It works because you concatenate the values to 1 string
0
Output chas and min in separate lines using separate System.out.println()
0
I got it. But why can't it be written in one line?
0
System.out.println(chas+""+min);
Why does it work?
0
Which operator takes two values?
0
What do you mean by which operator takes 2 values? You want to print both values, don't you?
0
I want to enumerate variables with ", " and output them. Is it possible?
0
You could use string formating and printf
System.out.printf("%d\n%d", 33,123);
0
What is printf responsible for? How is it different from println?
0
Whenever you want to know more about a method you can google for the document and for examples
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/PrintStream.html
https://docs.oracle.com/javase/tutorial/java/data/numberformat.html
0
thanks for the answer