0% found this document useful (0 votes)
3 views

C Coding Full Course Notes

The document provides an overview of arithmetic and relational operators in C programming, including their precedence and usage in expressions. It explains various control structures like sequence, decision, and loops, as well as the significance of conditional statements. Additionally, it covers increment and decrement operators, along with examples of their application in loops and pointer manipulation.

Uploaded by

kunalmakhija0001
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

C Coding Full Course Notes

The document provides an overview of arithmetic and relational operators in C programming, including their precedence and usage in expressions. It explains various control structures like sequence, decision, and loops, as well as the significance of conditional statements. Additionally, it covers increment and decrement operators, along with examples of their application in loops and pointer manipulation.

Uploaded by

kunalmakhija0001
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 92

ARITHMETIC

OPERATORS
IN C:
konsa operation phle perform hoga
knsa baad mei hoga…….
Sbse upr vale ki high
precedence ,down jaane pr
precedence kam.
 Sequence control: Jo 1 ke baad 1 chlti
hai
 Decision control: If/Else
 Loop control: for loop, while loop
 Case control: cases hote hai isme

 Arithmetic operators: +,-,/,*,%


 a==b: means we are asking whether
a=b or not.
 A=b: means value of b assigned in a

4==4 is true therefore, the output is 1 which means true.


4==3 is false therefore the output is 0 which means false.
1st relational operator: “==” it means equal to is is opp to “!=”

2nd relational operator:


“>,>=”: if we write 4>5 the output is 1
means true.
If we write 5>4 the output is 0 means false.
Example:
3rd relational oerator:
“<,<=”: if we write 7<8 the output is 1
means true.
If we write 8<7 the output is 0 means false.
Example:
4th relational operator:
“!=” : it means not equal to (it is opp. of
==)

&& means both the value has to be


true, if 1 is correct therefore false.
Example 1: 4>3 && 3<4
Both statement is correct therefore
true.
Example 2: 4>3 && 4<3
1st statement is true nut 2nd is false
therefore answer is false
|| means or.
In this case if both values are false then
only the statement is false, if 1
statement is true the statement is true,
if both are true the statement is also
true.
Example:

! means not.
Expression ko ulta krta hai.
Example 1:
(4>5) is true, but
!(4>5) is false.

Example 2:
1. A=b means value of b assigned to a or
a=4 means 4 has been assigned to a.
2. A+=b means a=a+b 9aisa tb hga jb left
hand side and right hand side same
variables honge.
3. A-=b means a=a-b;
4. A*=b means a=a*b;
5. a/=b means a=a/b;
6. a%=b means a=a%b;

 % is module operator :
Example 1 : 6%2 is 3 bcoz 3 is remainder
Example 2: 5%5 is 0 bcoz 0 is remainder
Conditional statements:
Types:
1. If-else
2. Switch

Example:
Example:
Example 1:

Output:
Example 2:
Output:

What happen if we not use break in switch


statement at every cases:
Example:
Example of b:

Output:
Practise questions:

Answer :
Solving by ternary method:
Output:

Question 2:
Question 3:
answer:
answer is “x is equal to 1” bcoz “x=2”
means x belongs to a.
but there we have to write a==b.

question 4:

Answer:
1st :
Example:

I+1 can also be written as i++.


1.

increment operators:
i++ and ++I
i++ means first print value of I and then
increase.
++I means first increase value of I then
print value of i.
2. Decrement operators:
i- -and - -i
I - - means first print value of I then
decrease it.
-- I means first decrease value of I then
print value of i.

3. Loop opeartors can be float or even


characters:
For example:

Here we have used int .


But we can also use float and char
for example:
taking float first:
Taking char now:
4. Infinite loop:

This will go infinite bcoz we have


not given condition(kahan tk jana
hai).
Example:
Answer:
Example:
Answer:
Example:
Example:
Answer:
Answer:
Answer:
Answer:
Answer:
Function name
‘*’ means value at address of;

‘&’ means address of ;


Printing address of;
Questions:

1.

2.

3.
In qn 3rd (*ptr)++
means *ptr=*ptr+1.
Answer
1:
Answer
2:

Answer
3:

You might also like