Recap Challenge #1
Part of the Fundamentals section of Coddy's C journey — lesson 34 of 63.
Challenge
EasyCreate a C program that:
- Reads user id, age, and height in meters using scanf()
- Calculates the user's age in days (assume exactly 365 days per year)
- Prints a formatted summary with the following information:
- User's id
- User's age in years and days
- User's height with exactly 2 decimal places
- User's height in centimeters (as an integer)
Your output should follow this exact format:
ID: [id]
Age: [years] years ([days] days)
Height: [height] m ([height_cm] cm)Try it yourself
#include <stdio.h>
int main() {
float height;
int id, age;
scanf("%d", &id);
scanf("%d", &age);
scanf("%f", &height);
// Calculate age in days and height in cm
// Print the formatted output
return 0;
}All lessons in Fundamentals
3Operators
Arithmetic OperatorsModulo OperatorIncrement/DecrementAssignment OperatorsRelational OperatorsLogical Operators Part 1Logical Operators Part 2Logical Operators Part 3Recap Challenge