Declare and Print

Lab C Beginner 10 points

Declare int age = 20, double height = 1.68 and char grade = 'B'. Print age=20 height=1.68 grade=B.

Input

None.

Output

One line.

Example

Output

age=20 height=1.68 grade=B
Sample output available
Editor
C

Hints

Use %d for int, %.2f for double, %c for char.

Solution explanation

C needs the type of every variable declared before use.

Show solution
#include <stdio.h>

int main() {
    int age = 20;
    double height = 1.68;
    char grade = 'B';
    printf("age=%d height=%.2f grade=%c\n", age, height, grade);
    return 0;
}
Output
Answer
HOME LEARN COMMUNITY DASHBOARD