What is the algorithm or main logic for this problem-- I want to find if an alphabet is pressed then it belongs to which row? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the algorithm or main logic for this problem-- I want to find if an alphabet is pressed then it belongs to which row?

In keyboard we have alphabets in three rows-- Row 1- Q to P Row 2- A to L Row 3- Z to M If a key is pressed ,this belong to which row?Only logic and language preferred is C, C++ or JS

16th May 2019, 7:25 AM
Pranjal Dahal
Pranjal Dahal - avatar
4 Answers
+ 3
your question is not clear enough, please state what you mean by row
16th May 2019, 7:38 AM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 3
Pranjal you can use array for this, whereby each character on the same row will be on the same array, and you can use loop to check through and a condition too
16th May 2019, 7:49 AM
✳AsterisK✳
✳AsterisK✳ - avatar
0
*AsterisK* see description
16th May 2019, 7:43 AM
Pranjal Dahal
Pranjal Dahal - avatar
0
*AsterisK* No, without comparing character by character.Is there any other ways?
16th May 2019, 7:51 AM
Pranjal Dahal
Pranjal Dahal - avatar