Take a moment to think about this
There's no new theory in this lesson — instead, we'll revisit variables, data types, operators, if-else, loops, arrays, and strings from earlier lessons through four practical tasks. Write the code for each task yourself before comparing it against the solution — that's what makes it stick in memory. If you run into a compiler error, don't panic: read the error message line by line and practice debugging it. The goal is to help you catch small syntax slip-ups (semicolons, braces, data type mismatches) before they trip you up.
Exercises
Task 1: Declare two integer variables (a, b), take user input for them, and print their sum, difference, product, and quotient using printf. Task 2: Use a for loop to print each even number from 1 to 50, one per line. Task 3: Write a program using an if-else if-else structure that takes a user's score (0-100) and returns a grade (A, B, C, F). Task 4: Declare a char array (string), calculate its length with strlen(), then use a loop to convert each character to uppercase and print it (you can use toupper() from <ctype.h>).
Code Example
// Task 1 starter skeleton
#include <stdio.h>
int main() {
int a, b;
printf("Enter two integers: ");
scanf("%d %d", &a, &b);
// TODO: sum, difference, product, quotient ကို တွက်ပြီး print ပါ
return 0;
}
// Task 3 starter skeleton
#include <stdio.h>
int main() {
int score;
printf("Enter score: ");
scanf("%d", &score);
// TODO: if-else if-else နဲ့ grade စစ်ပါ
return 0;
}Once you've run all 4 tasks yourself and the output matches what's expected, you'll know you've got a solid handle on the fundamentals lesson.5-Minute Challenge
Set a 5-minute timer right now and write Task 2 yourself — just remember, you only need the loop variable and the % operator.
A Quick Warning
Don't forget to compile and run each task — if you hit an error, start checking from the nearest line number.