DMCA.com Protection Status C Programming – Day 2 | Operators & Expressions Explained (Interactive Guide) - ZAREEN TECH WAVE -Largest Tutorials Website For Freelancer ZAREEN TECH WAVE -Largest Tutorials Website For Freelancer

Header Ads

C Programming – Day 2 | Operators & Expressions Explained (Interactive Guide)

OPERATORS AND EXPRESSIONS (INTERACTIVE)

DAY -2




✅ I’m marking Day-1 Completed 🎉
Now we move to:

📍 Day-2 — Operators & Expressions (Interactive)

Today you will learn:

1️⃣ Arithmetic Operators

2️⃣ Relational Operators

3️⃣ Logical Operators

4️⃣ Increment & Decrement

5️⃣ Mini Project + Quiz

After today’s tasks → I will start compiling everything.


✅ 1. Arithmetic Operators

OperatorMeaningExample
+Additiona + b
-Subtractiona - b
*Multiplicationa * b
/Divisiona / b
%Modulus (Remainder)a % b

Example:

int a = 10, b = 3; printf("%d", a % b); // Output: 1

✅ 2. Relational Operators

Used for comparison, result is True(1) or False(0)

OperatorMeaning
>Greater than
<Less than
>=Greater or equal
<=Less or equal
==Equal
!=Not equal

Example:

printf("%d", 5 > 2); // Output: 1

✅ 3. Logical Operators

OperatorMeaningExample
&&ANDTrue if both true
||ORTrue if any true
!NOTReverse result

Example:

int a = 5, b = 10; printf("%d", a < b && b > 0); // 1

✅ 4. Increment / Decrement

SymbolMeaning
++Increase by 1
--Decrease by 1

Example:

int x = 5; x++; // x becomes 6

🧪 Practice Example (Calculate Total Marks)

#include <stdio.h> int main() { int m1, m2, total; printf("Enter two subject marks: "); scanf("%d %d", &m1, &m2); total = m1 + m2; printf("Total Marks = %d", total); return 0; }

✅ Task-2 (You Must Solve)

Write a program to:

✔ Input 3 subject marks
✔ Calculate Total and Average
✔ Print the result

Example Output:

Total = 250 Average = 83.33

📌 Hint: Use → total = m1 + m2 + m3;
📌 Use float for average

Send me your code — I will review ✅


📝 Quick Quiz (Day-2)

Reply like: 1A, 2C, 3B

1️⃣ Which operator gives remainder?
A) %
B) /
C) *

2️⃣ Which operator checks equality?
A) !=
B) >
C) ==

3️⃣ Which gives "AND" logic?
A) ||
B) &&
C) !


When you send:

✔ Task-2 Code
✔ Quiz Answers

➡ I will mark Day-2 Completed
➡ Then move to Day-3: if-else Conditions


I’m waiting for your Task-2 solution! 🚀


No comments

Thank You For Visit My Website.
I Will Contact As Soon As Possible.

Theme images by 5ugarless. Powered by Blogger.