0

I am in trouble due to one question, can anyone help me to solve that?

Write a program to print 'F' to 'A' in five different lines.

29th Nov 2022, 5:26 PM
Anonymous
Anonymous - avatar
5 odpowiedzi
+ 8
Anonymous , please link your code attempt here.
29th Nov 2022, 6:08 PM
Lothar
Lothar - avatar
+ 3
1. Learn to use a loop, it can either be a while...loop or for...loop. Understand how to make the loop counter counts backwards instead of forward 2. Look up the net for a function named `chr` it will definitely help you in this task Come show your code when you got it all figured out
29th Nov 2022, 5:44 PM
Ipang
+ 2
Anonymous, I will assume you know ASCII codes, also remember ASCII code of letter 'A' is 65 and ASCII code of letter 'F' is 70. Function chr () takes a numeric argument and it can accept ASCII or Unicode values. The loop I was suggesting you to make was one that goes backwards from 70 down to 65, You can print return value from chr () within the loop body. Now you see why the loop has to go backwards ...
29th Nov 2022, 6:34 PM
Ipang
+ 2
Your request doesn't make sense. This problem can be solved with a single line of code. Why do you need it to be exactly 5 lines? Or if you mean the output should be on separate lines for each letter, then I want to point out that from F to A there are six letters. So you may want to skip a letter, or write two letters in the same line, or your specification is misleading :)
29th Nov 2022, 6:44 PM
Tibor Santa
Tibor Santa - avatar
+ 1
Ipang I know loops, but I don't know how to apply char function in this program. I need your more help to solve this problem.
29th Nov 2022, 5:59 PM
Anonymous
Anonymous - avatar