Programming is the art of giving instructions to a computer so that it can solve a problem. A computer cannot think on its own; it follows every instruction exactly as given. The set of instructions written to solve a problem is called a program, and the person who writes programs is called a programmer. Before writing a program, a programmer must plan carefully, because the computer will do exactly what is written, not what was meant. The whole process of planning and writing a program is called programming, and it involves understanding the problem, designing a solution, writing the code, testing it, and fixing the errors.
Solving a problem with a computer follows a fixed set of steps. The first step is to understand the problem completely and decide what input is needed and what output is expected. The second step is to plan the solution, which is done by drawing a flowchart or writing pseudocode. The third step is to write the program using a programming language. The fourth step is to test the program with sample data and find errors. The fifth step is to document the program so that other people can understand it. These five steps keep the work organised and reduce mistakes.
An algorithm is a step-by-step, ordered sequence of instructions to solve a problem. Every algorithm must have three qualities. It must be definite, which means every step must be clear and have only one meaning. It must be finite, which means it must stop after a limited number of steps. It must be effective, which means each step must actually do something useful. For example, an algorithm to make a cup of tea lists each action in order: boil water, put tea leaves in the cup, pour the water, add sugar, and stir. An algorithm is written in simple language, not in any computer language.
A flowchart is a pictorial representation of an algorithm, using different symbols for different actions. The oval symbol is used for the start and stop of the program. The parallelogram is used for input and output. The rectangle is used for processing steps and calculations. The diamond is used for decisions that give a yes or no answer, and arrows show the flow from one step to the next. A flowchart makes the logic of the program easy to see and easy to explain, and it helps in finding mistakes before the program is written.
Pseudocode is a mixture of simple English and programming terms that describes the logic of the algorithm, for example "IF marks are more than 40 THEN print PASS". Pseudocode is easier to write than a flowchart and easier to read than a real program. A programming language is a formal language used to write programs that the computer can execute. Languages can be divided into low-level languages, which are close to the machine, and high-level languages, which are close to human language and easier to use, such as Python, Java and BASIC. High-level languages must be translated into machine language before the computer can run them.
A variable is a named place in memory where a value is stored, and the stored value can change during the program. In the statement "age = 12", age is the variable and 12 is its value. Variables hold different kinds of data called data types. Integer data stores whole numbers such as 10 or -5. Floating point data stores numbers with a decimal point such as 3.14. Character data stores a single letter or symbol, and string data stores a sequence of characters such as "Hello Class 7". A constant is like a variable, but its value never changes during the program.
Programs control their flow in three ways. Sequence means the instructions run one after another in order, from top to bottom. Selection means the program chooses between different actions using a condition; the IF...THEN...ELSE statement makes a decision, for example IF age is greater than 12 THEN print "Teenager" ELSE print "Child". Iteration, also called a loop, repeats a group of instructions. The FOR loop repeats a known number of times, and the WHILE loop repeats as long as a condition is true. These three control structures can solve any problem that can be solved by a computer.
Errors in a program are called bugs, and the process of finding and removing them is called debugging. There are three main types of errors. Syntax errors happen when the rules of the language are broken, such as a missing bracket, and the program will not run. Runtime errors happen while the program is running, such as dividing a number by zero. Logical errors happen when the program runs but gives wrong answers because the logic is wrong, such as using + instead of *. Testing the program with different inputs and checking the output carefully is the best way to catch bugs.
| Symbol | Shape | Meaning |
|---|---|---|
| Oval | Oval | Start or stop of the program |
| Parallelogram | Parallelogram | Input and output |
| Rectangle | Rectangle | Processing and calculation |
| Diamond | Diamond | Decision with yes or no |
| Arrow | Arrow | Direction of flow |
| Data Type | Stores | Example |
|---|---|---|
| Integer | Whole numbers | 12, -5 |
| Floating point | Decimal numbers | 3.14 |
| Character | One symbol | 'A' |
| String | Text | "Hello Class 7" |
| Control Structure | Meaning | Example |
|---|---|---|
| Sequence | Steps run in order | Lines 1, 2, 3 |
| Selection | Decision between actions | IF...THEN...ELSE |
| Iteration | Repeating instructions | FOR loop, WHILE loop |
Programming is the process of turning a problem into instructions a computer can follow. Every solution begins with an algorithm, is planned visually with a flowchart or in words with pseudocode, and is then written in a programming language using variables, data types and the three control structures of sequence, selection and iteration. Errors are normal, and debugging is a natural part of the work. With these fundamentals, you are ready to write your first programs and use the computer as a true problem-solving tool.