Hỏi đáp
Chia sẻ kiến thức, cùng nhau phát triển
Cho em hỏi 2 bài này làm như thế nào ạ, mọi người demo giúp em với --- Áp dụng " switch .... case "
Bài 1:
You are creating a social media application, and need to develop a menu where the user can choose the topic he is interested in learning more about.
Here are the the topics marked by corresponding numbers:
1 - Sports
2 - Politics
3 - Business
4 - Technology
5 - Art
Write a program to take the number as input and output the corresponding topic name.
Sample Input
1
Sample Output
Sports
Bài 2:
You are making a game, where the player selects the difficulty level:
1 - Easy
2 - Medium
3 - Hard
You are given a program that takes the number as input.
Complete the program so that it will output the corresponding difficulty level.
If the user entered an invalid number, the program should output "Invalid option".
Sample Input
2
Sample Output
Medium
----- Em cảm ơn mọi người ạ -----