Please help ! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please help !

About. Program- You have to enter a country name and with last letter of country name the computer will display a country name and so on. Sample input-Afghanistan Computer will display-Nepal And so on https://code.sololearn.com/cm0BQkLY6ZcA/?ref=app https://code.sololearn.com/cm0BQkLY6ZcA/?ref=app

6th Dec 2019, 2:30 AM
Harshita Shreya
Harshita Shreya - avatar
1 Answer
0
I did notice there are multiple countries starting with the same letter. Approaching this is your choice, if you want to randomize what country comes out of the same letter, which im not sure sololearn supports in their compiler, but using eclipse or intellij it's just as simple as getting the country's last letter, country[country.length-1] and looping through all countries, if their last letter matches, add it to a temp array and then randomize through it and input an answer. If this wasn't quite what you wanted, explain it better and I will try to help.
10th Dec 2019, 6:14 AM
coddy
coddy - avatar