C Program to Declare Variables, Input Data & Display Output

Write a C program to declare variables, take user input, and display the output

#include <stdio.h>

int main() {
    // Declare variables
    int age;
    float height;
    char name[50];

    // Take input from user
    printf("Enter your name: ");
    scanf("%49s", name);

    printf("Enter your age: ");
    scanf("%d", &age);

    printf("Enter your height in meters: ");
    scanf("%f", &height);

    // Display the output
    printf("\nHello, %s!\n", name);
    printf("Your age is: %d years\n", age);
    printf("Your height is: %.2f meters\n", height);

    return 0;
}

একটি মন্তব্য পোস্ট করুন