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 Answers
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