A user types a word and a number on a single line. Read them into the provided v
ID: 3907074 • Letter: A
Question
A user types a word and a number on a single line. Read them into the provided variables. Then print: word_number. End with newline. Example output if user entered: Amy 5 Amy_5 1 #include 3 int mainCvoLd) t 1 test passed 4 char userWord120]; int userNum; All tests passed 7 printfC Enter a word and a number on a single line:" g scanf("%s %d" , user-word,auserNum); 10 11 //printing word.num 12 13 printfC"s d",userWord,userNum); 14 15 return 16 Run X Testing with: Amy 5 Output differs. See highlights below. Special character legend Your output Enter a word and a number on a single line: Amy_5Explanation / Answer
If you have any doubts, please give me comment...
#include<stdio.h>
int main(void){
char userWord[20];
int userNum;
//printf("Enter a word and a number on a single line:");
scanf("%s %d", userWord, &userNum);
printf("%s_%d", userWord, userNum);
return 0;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.