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.
4 Answers
+ 1
you can do that on console
but it's unnecessarily complex
you cannot do that on sololearn fyi
+ 1
ans:
int age;
scanf("%d", & age);
if(age > 21) {
printf("drinks allowed");
}
else if (age < 10) {
printf("study math");
}
0
it's not possible to print it, before it is entered.
you have to add another printf.
0
The Answer:
int age;
scanf("%d", & age);
if(age > 21) {
printf("drinks allowed");
}
else if (age < 10) {
printf("study math");
}