64 630
Assignments Done
99,1%
Successfully Done
In September 2018

Answer to Question #67789 in C for abdul

Question #67789
A C program is needed for Children Camping Registration Day. The program has one user-defined function named Event( ). This function will ask 2 inputs from user (name and age), then it returns the participant’s age to main( ). If the participant is between 7 and 12 years old, the participant is considered as kid. If the participant is between 13 and 17 years old, the participant is considered as teenager. Write the program by implementing while loop and if-else statement.
Expert's answer
#include <stdio.h>
#include <stdlib.h>

int Event();

int main()
{
int age;
age = Event();
if (age > 6 && age < 13)
printf("Participant is kid.");
else
if (age > 12 && age < 18)
printf("Participant is teenager.");
return 0;
}

int Event()
{
char name[255];
int age;
printf("Enter user name: ");
scanf("%s", name);
printf("Enter user age: ");
scanf("%d", &age);
return age;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions