+ 1

c

https://code.sololearn.com/cf2vm9JlioZV/#c in the provided code, what changes will be necessary so as the final run asks the user for input?

5th Jul 2019, 8:25 AM
Aman
Aman - avatar
7 Réponses
+ 3
Use - scanf("%d", &num); Before switch () statement to get 'num' value from user.
5th Jul 2019, 8:41 AM
Kuri
Kuri - avatar
+ 1
cant i use gets(num); ?
5th Jul 2019, 8:46 AM
Aman
Aman - avatar
+ 1
سلام
2nd Jun 2020, 5:50 AM
alireza
alireza - avatar
+ 1
میشه کمکم کنید
2nd Jun 2020, 5:50 AM
alireza
alireza - avatar
0
gets(num) is used to take string input containing spaces. So here scanf would be better.
22nd Feb 2020, 5:05 PM
Aryaman Mishra 🇮🇳
Aryaman Mishra 🇮🇳 - avatar
0
#include <stdio.h> int main() { int num ; printf("Enter the value:"); scanf("%d",&num); switch (num) { case 1: case 2: case 3: printf("One, Two, or Three.\n"); break; case 4: case 5: case 6: printf("Four, Five, or Six.\n"); break; default: printf("Greater than Six.\n"); } }
17th Apr 2020, 12:01 PM
Shashank Peddareddappa
Shashank Peddareddappa - avatar
0
چه کمکی میخواید ؟
4th Aug 2020, 11:50 AM
Saba Amiri
Saba Amiri - avatar