3-1 Please do the coding in C language! Here is a listing of a program, which as
ID: 3814150 • Letter: 3
Question
3-1
Please do the coding in C language!
Here is a listing of a program, which asks a user to enter his/her age. It will print: a) "You are a golden" if the entered age is 50 and b) "You are not so golden" otherwise. #include int main() {int yourAge; printf(*'How old are you?: "); scanf("%d", &yourAge;); if (yourAge == 50) printf("You are golden "); else print-f("You are not so golden "); return 0;} Modify the above program, so that it will print: "You are a kid" if the age is less than 13 "You are a teenager" if the age is between 13 and 19 "You are an adult" if greater than 19Explanation / Answer
#include <stdio.h>
int main()
{
int yourage;
printf("How old are you?");
scanf("%d",&yourage);
if(yourage<13)
printf("YOu are a kid ");
elseif(yourage>=13 && yourage<19)
printf("You are a teenager ");
else
printf("YOu are an adult ");
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.