/**/ C Programs on Operators - Dextutor

C Programs on Operators

1.A recipe calls for baking a cake at 180 degrees Celsius. However, your oven only shows Fahrenheit temperature.
Task: Calculate the equivalent Fahrenheit temperature for baking the cake. (Formula: Fahrenheit = (Celsius * 9/5) + 32)

2. You are driving on a highway with a speed limit of 70 miles per hour. You travel 105 miles in 1.5 hours.
Task: Calculate your average speed during the journey. (Formula: Average Speed = Distance / Time)

3. You are buying apples that cost $2.50 per pound. You want to buy 3 pounds but only have $7.
Task: Determine if you have enough money to buy the desired apples. (Formula: Total Cost = Price per pound * Quantity)

4. Sarah is building a rectangular fence for her vegetable garden. She uses two types of wood: 3-meter planks for the length and 2-meter planks for the width. She wants to enclose an area of 12 square meters.
Determine how many 3-meter planks she needs for the length.
Determine how many 2-meter planks she needs for the width.
Calculate the total number of planks needed for the fence.
Required Formulas:
Number of 3-meter planks: Total area / Length of each plank (12 square meters / 3 meters/plank)
Number of 2-meter planks: Total area / Width of each plank (12 square meters / 2 meters/plank)
Total number of planks: Number of 3-meter planks + Number of 2-meter planks

5. Maria is painting a picture and needs to mix three primary colors: red, blue, and yellow. The recipe calls for 2 parts red, 3 parts blue, and 1 part yellow. She wants to paint a large canvas that requires a total of 150 milliliters of paint.
Calculate the total amount of each color needed based on the recipe (red, blue, and yellow).
Since Maria wants 150 ml of paint in total, determine what factor to multiply each color amount by to reach the desired volume.
Required Formulas:
Color amount (each): Total recipe amount * Recipe ratio (e.g., Red amount = 150 ml * 2/6)
Multiplication factor: Desired total volume / Sum of individual color amounts (150 ml / (Red amount + Blue amount + Yellow amount))

6. Maria runs a small shop selling fruits. She offers apples at ₹20 each and oranges at ₹15 each. Help Maria calculate her total revenue for the day by writing a C program that takes the quantity of each fruit sold as input and outputs the total revenue using only arithmetic operators.

7. Write a program to:
a) Input a three-digit number
b) Delete the last digit and save in a variable “rem”
c) Multiple “rem” with 5 and print the result
d) Also print the remaining 2 digit number (after step 2)

8. Michael wants to buy a movie ticket. The ticket costs $12 for adults and $8 for children. Write a program that asks Michael’s age and prints the ticket price based on his age category.
Note: Use Conditional Operators (? and : )only. Do not use if-else

9. The ideal temperature for swimming is 25 degrees Celsius. Write a program that asks the user for the current temperature. If the temperature is above 25, print “Perfect for swimming!”; if it’s below 20, print “Too cold for swimming”; otherwise, print “Enjoyable for some!”.
Note: Use Conditional Operators (? and : )only. Do not use if-else

10. Professor Patel wants to automate his grade-assigning process based on student marks. Help him write a C program that takes a student’s mark as input and uses only the ternary operator to assign a letter grade based on the following criteria:
90 – 100 marks: A (Excellent)
80 – 89 marks: B (Very Good)
70 – 79 marks: C (Good)
60 – 69 marks: D (Satisfactory)
Below 60 marks: F (Needs Improvement)
Note: Use Conditional Operators (? and : )only. Do not use if-else