C Programming Chapter1
C Programming Chapter1
Section 1
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 2
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 3
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 4
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 5
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 6
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 7
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 8
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 9
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 10
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 11
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 12
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 13
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 14
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 15
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 16
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 17
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 18
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 19
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 20
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 21
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 22
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 23
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 24
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 25
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 26
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 27
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 28
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 29
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 30
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 31
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 32
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 33
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 34
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 35
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 36
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 37
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 38
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 39
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.
Section 40
Basic structure of a C program includes: preprocessor directives, main function, variable declarations,
and statements.
Example Program:
Key Concepts:
- Variables and Data Types - Input and Output - Operators - Control Statements
Practice Problems:
1. Write a program to print your name. 2. Write a program to add two numbers. 3. Write a program to
check even or odd.
Solutions:
1. Use printf to print your name. 2. Use variables and + operator. 3. Use if-else condition.