Declare and Print
Completed
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
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;
}