+ 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?
7 Answers
+ 3
Use - scanf("%d", &num);
Before switch () statement to get 'num' value from user.
+ 1
cant i use gets(num); ?
+ 1
سلام
+ 1
میشه کمکم کنید
0
gets(num) is used to take string input containing spaces. So here scanf would be better.
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");
}
}
0
چه کمکی میخواید ؟