Lecture 3
Lecture 3
Section - 5
Arithmetic operations
2
Arithmetic Operators
3
Examples:
Output
4
Examples:
Output
Examples:
Output
Assignment operations
7
Assignment Operators
8
Examples:
Output
9
Relational operations
10
Relational Operators
11
Examples:
Output
12
Logical operations
13
Logical Operators
14
Scanf()
15
Format specifiers
•The Format specifier is a string used in the formatted input and output
functions. The format string determines the format of the input and
output. The format string always starts with a '%' character.
Data type Format type
int %d or %i It is used to print the signed integer value where signed
integer means that the variable can hold both positive and
negative values.
float %f It is used for printing the decimal floating-point values. By
default, it prints the 6 values after '.'.
char %c It is used to print the unsigned character.
Double %lf it can easily accommodate about 15 to 17 digits after or
before a decimal point. 16
Inputs
17
Examples:
18
If statement
19
Simple if
20
If-else
21
If-else if- else
22
Task
23
Answer:
24
Answer:
25
THANK YOU