C Variables – Examples
1. Declaring and Initializing Variables
Output:
2. Changing Variable Values
Variables can change values during program execution:
Output:
3. Declaring Multiple Variables
Output:
4. Using scanf() to Assign Variable Values
Sample Output:
5. Example: Using Variables in Calculations
Sample Output:
✅ Key Points from Examples:
-
Variables must be declared before use.
-
You can assign values during declaration or later.
-
Multiple variables of the same type can be declared together.
-
Use
printf()to display values andscanf()to take input. -
Variable values can be updated or used in calculations anytime.
