Need help with this problem! | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

Need help with this problem!

Write two scanf statements to get input values into birthMonth and birthYear. Then write a statement to output the month, a slash and the year. End with newline. The program will be tested with inputs 1 2000 and then with inputs 5 1950. Ex: if the input is 1 2000, the output is 1/2000 Note: The input values come from user input, so be sure to use scanf statement, as in scanf(ā€œ%dā€, &birthMonth), to get those input values( and donā€™t assign values directly, as in birthMonth=1)

7th Jan 2022, 10:49 PM
Altesse
3 Respostas
0
#include <stdio.h> Int main(void) { Int birthMonth; Int birthYear; Scanf (ā€œ%dā€, &birthMonth); Scanf(ā€œ%dā€, &birthYear); Printf(ā€œ%dā€, birthMonth); Printf(ā€œ%dā€, birthYear); return 0; } My output is 12000 instead of 1/2000
7th Jan 2022, 10:54 PM
Altesse
0
#include <stdio.h> Int main(void) { Int birthMonth; Int birthYear; scanf (ā€œ%dā€, &birthMonth); scanf(ā€œ%dā€, &birthYear); printf(ā€œ%d/%dā€, birthMonth, birthYear); return 0; }
8th Jan 2022, 12:03 AM
William Owens
William Owens - avatar
0
#include <stdio.h> int main(void) { int birthMonth; int birthYear; scanf("%d", &birthMonth); scanf("%d", &birthYear); printf("%d", birthMonth); printf("/%d\n", birthyear); return 0; }
23rd Oct 2022, 12:20 AM
Jesse lin
Jesse lin - avatar