Question 01
Write a C program that calculates the force based on Newton’s second law of motion. The program should prompt the user to enter the mass of an object (in kilograms) and its acceleration (in meters per second squared). It should then compute the force using the formula: F = m × a. Assume the numbers can contain non-integers. Use the following help.
// Define a decimal number (floating-point number) e.g. 9.8
float num;
// Read a floating-point number
scanf("%f", &num);
// Write the result
printf("%f");
// Write the result with a precision of 2 digits after
// after the floating point
printf("%.2f");
Question 02
Write a C program that calculates the kinetic energy of an object based on the formula: KE=(1/2)mv2.
Question 03
Write a C program that asks the user to input the temperature of water (in degrees Celsius) and determines its physical state: solid, liquid, or gas.
-
Water is solid if the temperature is less than or equal to 0oC.
-
Water is liquid if the temperature is between 0oC and 100oC (exclusive).
-
Water is gas if the temperature is greater than or equal to 100oC.
The program should then output the state of the water. Use the following help.
// If A is less than or equal to B
A <= B
// If A is greater than or equal to B
A >= B
// If condition1 AND condition2
if(condition1 && condition2)
{...}
Question 04
Write a C program that calculates the Body Mass Index (BMI) of a person. The program should ask the user to enter their weight in kilograms and height in meters. It then calculates the BMI using the formula: BMI=weight/height2. Based on the BMI value, the program should classify the person as:
-
Underweight if BMI is less than 18.5,
-
Normal weight if BMI is between 18.5 and 24.9,
-
Overweight if BMI is between 25 and 29.9,
-
Obese if BMI is 30 or higher.