A variable is like a little box that holds data. In C, you have to declare a data type before you can use a variable — because the compiler needs to know how much memory to reserve and how to read the value.
c
#include <stdio.h>
int main() {
int age = 20;
float price = 19.99;
char grade = 'A';
printf("Age: %d
", age);
printf("Price: %.2f
", price);
printf("Grade: %c", grade);
return 0;
}int holds an integer, float holds a decimal number, and char holds a single character. %d, %.2f, and %c are format specifiers — they tell printf how to format the variable in the output.
You should see
Age: 20 Price: 19.99 Grade: AInfo
%.2f means "show exactly 2 decimal places." It's handy when displaying money or prices.