C Programming Notes for Kids
Part 1: Getting Started (Pages 1–10) Page 1 – What is Programming? Programming is like telling
a robot what to do step by step. Imagine you want a robot to make tea. 1. Boil water 2. Add tea
leaves 3. Pour in a cup 4. Add sugar That's exactly what programming does – giving step-by-step
instructions to a computer. Exercise: Write down 3 steps to tell a robot how to brush teeth.
Page 2 – What is C? C is one of the oldest and most powerful programming languages. It is called
the "mother of programming" because many languages (like C++, Java, Python) were built from it.
Fun fact: Windows, Linux, and even video games use C! Exercise: Name 2 things around you that
might use C.
Page 3 – Installing a C Compiler To write C programs, you need a compiler. It's like a translator that
changes your English instructions into computer language. Options: - GCC (Free and popular) -
Turbo C (Old, used in schools) - Online compilers (like repl.it, JDoodle) Exercise: Ask an adult to
help you open an online C compiler and type printf("Hello!");
Page 4 – Writing First C Program Every C program starts with #include and main(). Example:
#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}
This prints “Hello, World!” on the screen. Exercise: Change the text to your name and print it.
Page 5 – Structure of a C Program Every C program has 3 important parts: 1. Header Files →
#include (like a toolbox) 2. main() Function → The starting point 3. Braces {} → Grouping code
together Exercise: Write down a skeleton program with just main() and {}.
Page 6 – Printing Messages with printf printf is like speaking to the computer screen.
#include <stdio.h>
int main() {
printf("I love pizza!\n");
printf("C is fun!\n");
return 0;
}
Exercise: Print 3 of your favorite foods.
Page 7 – Comments in C Comments are notes for humans, not for the computer.
#include <stdio.h>
int main() {
// This is a single-line comment
printf("Learning C is fun!\n"); // Prints a message
/* This is a
multi-line comment */
return 0;
}
Exercise: Add a comment with your name in your program.
Page 8 – Variables A variable is like a box where you can store things (numbers, words, etc).
#include <stdio.h>
int main() {
int age = 10;
printf("I am %d years old\n", age);
return 0;
}
Exercise: Make a variable for your age and print it.
Page 9 – Data Types Different boxes hold different things: - int → whole numbers (5, 10, -3) - float
→ decimal numbers (3.14, 7.5) - char → single character (‘A’, ‘b’)
#include <stdio.h>
int main() {
int score = 95;
float pi = 3.14;
char grade = 'A';
printf("Score: %d\n", score); printf("Pi: %.2f\n", pi); printf("Grade: %c\n", grade); return 0; }
Exercise: Create a variable for your name (hint: use char).
Page 10 – Simple Math in C C can do math just like calculators.
#include <stdio.h>
int main() {
int a = 5, b = 2;
printf("Sum: %d\n", a + b);
printf("Difference: %d\n", a - b);
printf("Multiply: %d\n", a * b);
printf("Divide: %d\n", a / b);
return 0;
}
Exercise: Try changing a and b to your own numbers.