Question

Write the following program using the if/else decision structure using C programming. This problem calculates the...

Write the following program using the if/else decision structure using C programming. This problem calculates the cost of a movie ticket. If a person is 5 years old or younger, the movie ticket is free. If the person is over 65, then the movie ticket costs $5.00. Everyone else pays $10.00. Your program should ask for the person’s age. It should also print output which looks like this: You are (put their age her) year old, so your movie ticket will cost ( put the amount here). Upload a screenshot of your program and the results of running the program.

Homework Answers

Answer #1

#include<stdio.h>

int main() {
int age;
printf("Enter the age : ");
scanf("%d",&age);
if(age<=5)
printf("You are %d year old, so your movie ticket will cost free",age);
else if(age>65)
printf("You are %d year old, so your movie ticket will cost $5.00",age);
else
printf("You are %d year old, so your movie ticket will cost $10.00",age);
}

// If any doubt please comment

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write a program that checks the age of a user (C++ Programming)    If the user...
Write a program that checks the age of a user (C++ Programming)    If the user is 18 to 20 print “Sing a song” If the user is younger than 18 then print “Please show a dance step” Else Welcome the user and print “You are audience”
C# Programming Using the Example provided in this Week Folder,Create a Console application that solve the...
C# Programming Using the Example provided in this Week Folder,Create a Console application that solve the following problem: The heating system in a school should be switched on if the average temperature is less than 17 degrees Celsius. The average temperature is found from the temperatures in the Math, English and IT departments. You are required to write a program that allows the user to input 3 temperatures. The program calculates and displays the average temperature and then displays "heating...
In C programming, Thank you Write a program to compute the area of a circle. You...
In C programming, Thank you Write a program to compute the area of a circle. You have to write a complete “C” program that compiles and runs in Codeblocks. Program requirements: 1. Declare the variables needed: radius (r) and area (yourLastName). 2. Calculate and print the area of each circle. 3. The program MUST prompt the user for a new radius (r) over and over until the user types -1. 5. Use the type double for all decimal numbers. 6....
C Programming: I am working on the problem below and have got all of the code...
C Programming: I am working on the problem below and have got all of the code down, except for one part I can't figure out. The logic for the calculation where the the total at each shop is giving after each iteration of the loop. this is the formula I've got: ingredientPrice += ingredient1; It calculates the total for the first shop properly, but for the shops that follow it gives a cumulative total rather than the singular total for...
Write a code in c++ using linear insertion following the steps below. Comment your work. 1....
Write a code in c++ using linear insertion following the steps below. Comment your work. 1.    Ask the user for the name of a file containing data. If it does not exist, the program should display an error, then ask for a new file name. Entering an asterisk (*) as the first and only character on a line should terminate the program. 2.     You can use a statically-allocated one-dimensional array of doubles for this with length 100. You...
Program Description A local company has requested a program to calculate the cost of different hot...
Program Description A local company has requested a program to calculate the cost of different hot tubs that it sells. Use the following instructions to code the program: File 1 - HotTubLastname.java Write a class that will hold fields for the following: The model of the hot tub The hot tub’s feature package (can be Basic or Premium) The hot tub’s length (in inches) The hot tub’s width (in inches) The hot tub’s depth (in inches) The class should also...
1. Please use only the C as the language of programming. 2. Please submit/upload on Canvas,...
1. Please use only the C as the language of programming. 2. Please submit/upload on Canvas, the following les for each of your programs: (1) the client and the server source les each (2) the client and the serve executable les each (3) a brief Readme le that shows the usage of the program. 3. Please appropriately comment your program and name all the identiers suitable, to enable enhanced readability of the code. Problems 1. Write an ftp client that...
Case Study 1 Calculations: Calculate the client's target heart rate using the Karvonen formula. Training Program:...
Case Study 1 Calculations: Calculate the client's target heart rate using the Karvonen formula. Training Program: Design a full 12-week periodized training program for the client described in the Client Profile. Be very specific as you design the training program. This is an opportunity for you to demonstrate your full comprehension of the information and concepts discussed throughout the course. List the types of exercise, duration, sets, reps, rest intervals, and so on. Include the following in your case study...
Case Study 2 Calculations: Calculate the client's target heart rate using the Karvonen formula. Training Program:...
Case Study 2 Calculations: Calculate the client's target heart rate using the Karvonen formula. Training Program: Design a full 12-week periodized training program for the client described in the Client Profile. Be very specific as you design the training program. This is an opportunity for you to demonstrate your full comprehension of the information and concepts discussed throughout the course. List the types of exercise, duration, sets, reps, rest intervals, and so on. Include the following in your case study...
Write a Python 3 program called “parse.py” using the template for a Python program that we...
Write a Python 3 program called “parse.py” using the template for a Python program that we covered in this module. Note: Use this mod7.txt input file. Name your output file “output.txt”. Build your program using a main function and at least one other function. Give your input and output file names as command line arguments. Your program will read the input file, and will output the following information to the output file as well as printing it to the screen:...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT