0
Justification in java, how to create this space in output
Java 100 Cpp 065
5 Antworten
0
Yes. C function printf works better.
System.out.printf("%s %03d", "java", 100);
Add remaining same way..
Or use String.format() works same as printf.
+ 2
public class Program {
public static void main(String[] args) {
String output = String.format("C: %1$d\nCpp: %2$d\nJava: %3$d",
100 , 065 , 050);
System.out.println(output);
}
}
+ 1
You want a tab as space? This is \t
0
If you send a code we can help you
0
Input-
Java 100
Cpp 65
Python 50
Output-
Java. 100
Cpp. 065
Python. 050
I hope you'll get it .....