Menu
Coddy logo textTech

Recap Challenge #1

Part of the Fundamentals section of Coddy's C journey — lesson 34 of 63.

challenge icon

Challenge

Easy

Create a C program that:

  1. Reads user id, age, and height in meters using scanf()
  2. Calculates the user's age in days (assume exactly 365 days per year)
  3. 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