Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Thursday, 2 June 2016

PROBLEM 4:
Write a C Program to print the ticket charge given the age of the person. The charges are as follows:
Over 75: $10.00
55–74: $12.00
21–54: $15.00

13–20: $10.00 
3–12: $5.00 
Under 3: Free.

CODE:
#include<stdio.h>
main ()
{
  int age=0,price=0;
  printf("Enter your age for ticket price:");
  scanf("%d",&age);
  if(age<3)
  {
      printf("your are free");
  }
  else if(age>=3 && age<=12)
  {
      printf("your ticket price is 5$");
  }
  else if(age>=13 && age<=20)
  {
      printf("your ticket prize is 10$");
  }
  else if(age>=21 && age<=54)
  {
      printf("your ticket price is 15$");
  }
  else if(age>=55 && age<=74)
  {
      printf("your ticket price is 12$");
  }
  else
  {
      printf("your ticket price is 10$");
  }

    return 0;s
}
Program Output:





For more problems click here


No comments:

Post a Comment