+ 1
print a to z without any loop on press of any key in keyboard . how can you solve it?
3 Answers
+ 4
print("abcdefghijklmnopqrstuvwxyz")
0
All letters have their numerical codes. I don't know what programming language you are using, so I will be as general as possible.
Let's assume A has code 45
(it is not, but we are about method, not realization). Then B will be 46 and so on. We have 26 letters.
Initiation:
CurrentCode = 45;
Event on keyboard key pressed:
PrintLetterByCode( CurrentCode );
CurrentCode + 1;
IF ( CurrentCode == 45+26 )
THEN CurrentCode = 45;
Adopt to your kanguage and bind event on keypress. Loop without looping. Only condition.