0

how to enter a word after a scanf session?

like this: int age; printf("Enter Your Age_"); scanf(%d, &age); I want a "Years" part behind like this, printf("Enter Your Age_ Years") and the value that enter to "age" variable must be between "Age_" and "Years" parts. how to do that? this years part must display while we entering a value.to age variable.

9th Dec 2019, 2:49 PM
lakshan u.a.i
lakshan u.a.i - avatar
4 Respuestas
+ 1
you can do that on console but it's unnecessarily complex you cannot do that on sololearn fyi
10th Dec 2019, 11:25 AM
Shen Bapiro
Shen Bapiro - avatar
+ 1
ans: int age; scanf("%d", & age); if(age > 21) { printf("drinks allowed"); } else if (age < 10) { printf("study math"); }
8th Dec 2021, 4:24 PM
Medhat Mohamed Ibrahim Abu Mandour
Medhat Mohamed Ibrahim Abu Mandour - avatar
0
it's not possible to print it, before it is entered. you have to add another printf.
9th Dec 2019, 4:29 PM
Bahhaⵣ
Bahhaⵣ - avatar
0
The Answer: int age; scanf("%d", & age); if(age > 21) { printf("drinks allowed"); } else if (age < 10) { printf("study math"); }
8th Sep 2022, 10:18 AM
FATIMA USMAN TSOHO
FATIMA USMAN TSOHO - avatar