1.
Algorithm:
An algorithm is a step-by-step procedure to solve a problem.
Example: To add two numbers:
1. Start
2. Input two numbers
3. Add them
4. Show result
5. End
2. Flowchart:
A flowchart is a diagram that shows steps of a process using symbols.
Example: A flowchart to add two numbers has Start, Input, Process, Output, and End symbols.
3. Flowchart Symbols:
- Terminator: Start/End (Oval)
- Process: Task or Operation (Rectangle)
- Input/Output: Data Input or Output (Parallelogram)
- Decision: Yes/No or True/False (Diamond)
- Arrow: Flow of steps
4. History of C:
C was developed by Dennis Ritchie in 1972 at Bell Labs. It was made to write the UNIX OS.
5. Importance of C:
- Fast and powerful
- Used in system and embedded programming
- Portable and easy to learn
6. C Character Set:
Includes letters (A-Z, a-z), digits (0-9), symbols (+, -, *, etc.), and special characters.
7. C Tokens:
Smallest units in a C program: Keywords, Identifiers, Constants, Strings, Operators, etc.
8. C Keywords:
Reserved words with special meaning. Example: int, return, if, else, for.
9. Identifier:
Name given to variables, functions, etc.
Rules:
- Can't start with digit
- Only letters, digits, underscore
- No keywords
10. Constant:
Fixed value. Types: Integer, Float, Character, String
11. Variable:
Named memory location. Declared as:
int a; float b; char c;
12. Data Types in C:
- int: integers
- float: decimal numbers
- char: characters
13. Storage Classes:
- auto: default
- extern: external linkage
- static: retains value
- register: fast access
14. Assign Values:
int a = 10;
15. Symbolic Constants:
Constants defined using #define.
Example: #define PI 3.14
16. Variable as Constant/Volatile:
- const int x = 10; // constant
- volatile int y; // value may change anytime
17. Escape Sequences:
- \n: new line
- \t: tab
- \": double quote
18. Structure of C Program:
- Header files
- main() function
- Variable declarations
- Statements
19. Format Specifiers:
- %d: int
- %f: float
- %c: char
- %s: string
20. Algorithm for Addition:
1. Start
2. Input A, B
3. Sum = A + B
4. Print Sum
5. End
21. Flowchart for Multiplication:
(Include basic input, process, and output symbols)
22. Algorithm + Flowchart for Simple Interest:
Algorithm:
1. Start
2. Input P, R, T
3. SI = (P * R * T) / 100
4. Print SI
5. End
(Flowchart includes input/output/process symbols)