Suppose following is a letter-based pattern,I am finding difficulty to print the letters with space between? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 2

Suppose following is a letter-based pattern,I am finding difficulty to print the letters with space between?

char i,j; for (i='D';i>='A';i--) { for (j=i;j<='D';j++) { System .out.print(j ); } System .out .println (); } these are the codes of my pattern , kindly make necessary changes in these codes so I can know how it should be done.

12th Nov 2017, 6:57 AM
Amartya D
Amartya D - avatar
1 Réponse
+ 5
If you want to add space beetwen them just put System.out.print(j + " ");
12th Nov 2017, 7:34 AM
Vukan
Vukan - avatar