Answer to Question #67843 in C for abdul
2017-04-28T08:44:22-04:00
i want program for output below;
Welcome to Children Camping Program
Name: Suzana
Age: 9
More participants (y/n)? y
Name: Alia
Age: 10
More participants (y/n)? y
Name: Farhan
Age: 10
More participants (y/n)? y
Name: Ali
Age: 15
More participants (y/n)? n
Total Participants
Kids : 3
Teenagers: 1
1
2017-04-29T08:39:08-0400
/* users choice */ int kidsQuantity = 0; /* number of kids */ int teenagersQuantity = 0; /* number of teenagers */ char name[256]; int age; printf("Welcome to Children Camping Program\n\n"); do { printf("Name: "); scanf("%s", name); /* getting name */ printf("Age: "); scanf("%d", &age); /* getting age */ if (age < 13) { kidsQuantity++; } else if (age < 20) { teenagersQuantity++; } printf("More participants (y/n)? "); scanf(" %c", &choice); /* getting user choice */ printf("\n"); } while (choice == 'y'); /* displaying results */ printf("Total Participants\n"); printf("Kids: %d\n", kidsQuantity); printf("Teenagers: %d\n", teenagersQuantity); return 0; }
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 !
Learn more about our help with Assignments:
C
Comments
Leave a comment