Justification in java, how to create this space in output | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Justification in java, how to create this space in output

Java 100 Cpp 065

22nd May 2020, 8:55 PM
Rupali Tomar
Rupali Tomar - avatar
5 Answers
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.
22nd May 2020, 9:36 PM
Jayakrishna 🇮🇳
+ 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); } }
24th May 2020, 12:09 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
You want a tab as space? This is \t
22nd May 2020, 9:01 PM
Sandra Meyer
Sandra Meyer - avatar
0
If you send a code we can help you
22nd May 2020, 8:58 PM
4lx
4lx - avatar
0
Input- Java 100 Cpp 65 Python 50 Output- Java. 100 Cpp. 065 Python. 050 I hope you'll get it .....
22nd May 2020, 9:01 PM
Rupali Tomar
Rupali Tomar - avatar