Why this java program is not giving any output?[Solved] | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Why this java program is not giving any output?[Solved]

Hi, I just created this code that is supposed to convert a int into char and just give me the result. But it's not showing anything. I know it must be giving some output atleast because otherwise SoloLearn would say "No output." But that's not the case, then what is the problem? Please help. https://code.sololearn.com/cS6lR2LX9sGB/?ref=app

23rd Mar 2021, 6:33 PM
ltsRoy
ltsRoy - avatar
4 ответов
+ 4
because charcodes from 1 to 26 are not printable characters... to print letters you must use: System.out.println((char)(i+64)); or: System.out.println((char)(i+96)); former print uppercase letters, while later print lowercase letters ;)
23rd Mar 2021, 6:38 PM
visph
visph - avatar
+ 2
The first charcode that will give a visible output is 33. Try for(int i=33;i<=127;i+=2)
23rd Mar 2021, 6:40 PM
ChaoticDawg
ChaoticDawg - avatar
+ 2
visph Thank you very much!
23rd Mar 2021, 6:42 PM
ltsRoy
ltsRoy - avatar
+ 2
ChaoticDawg Thank you!
23rd Mar 2021, 6:42 PM
ltsRoy
ltsRoy - avatar