A C program is a set of instructions.
there are three type of instructions--
1 Type declaration instructions
2 Arithmetic Instrucitons
3 Control Instructions
a+b --- a,b= operands and + is operator
operands can be int/float etc
example 1 - Area of a square with power function
An arithmetic operation between
int and int = int
int and float = float
float and flaot = float
Ex:- int k = 3.0/9
value of k=?
ans-- 0.3333
example- Program on Type conversion
In C programming, there's no BODMAS rule applied
Operator priority in c
1st-- *, /, %
2nd-- +, -
3rd-- =
Note:- In the absence of parentheses
when operators of equal priority are present in an expression, The tie is take care of by associativity.
x*y/z =- (x*y)/z
x/y*z =- (x/y)*z
* , / follows left to right associativity.
Program on Operator Associativity and Operator priority
we will see them most in next chapters
Determines the flow of control in a program four types of control instructions in C are:
1. Sequence Control Instruction
2. Decision Control Instruction
3. Loop control Instruction
4. Case control Instruction Q. int v = 3^3; ans- it's valid because in C ^ is a bitwise zor operator
Q2.- Write a program to check whether a number is divisible by 97 or not.
Q3- Write a program to find the square of a number input by the user.
Q4- Write a program to calculate the average of three numbers.
Q5- Write a program to find the ASCII value of a given ASCII code.
Q6- Write a program to find the ASCII code of a given ASCII value.
Q7- Write a program to find the square root of a number.