Muhammad Siddique Ali 002
Task 1:
#include <iostream>
Using namespace std;
// Ye program user se 6-digit number input leta hai
// aur us number ke har digit ko division aur modulus ki madad se
// alag alag nikal kar display karta hai
Int main(){
Int num = 0;
Cout << “Enter 6 digit number:”;
Cin >> num;
Cout << num / 100000 << “, “;
Cout << (num / 10000) % 10 << “, “;
Cout << (num / 1000) % 10 << “, “;
Cout << (num / 100) % 10 << “, “;
Cout << (num / 10) % 10 << “, “;
Cout << num % 10;
Return 0;
Task 2:
#include <iostream>
Using namespace std;
// Ye program user se 4 values (a, b, c, d) leta hai
// aur check karta hai ke equation (a/b + c/d = (ad + bc)/bd)
// sahi hai ya nahi
// Dono sides ko calculate karke compare krta hai
Int main() {
Float a, b, c, d;
Cout << “Enter a: “;
Cin >> a;
Cout << “Enter b: “;
Cin >> b;
Cout << “Enter c: “;
Cin >> c;
Cout << “Enter d: “;
Cin >> d;
Float left = (a / b) + (c / d);
Float right = (a * d + b * c) / (b * d);
If (left == right)
Cout << “equation is correct”;
Else
Cout << “equation is not correct”;
Return 0;
Task 3:
#include <iostream>
Using namespace std;
// Ye program user se 4 characters input leta hai
// aur unko different styles mein display karta hai:
// seedha (abcd)
// ulta (dcba)
// space ke sath (a b c d)
// pairs mein (ab cd)
Int main() {
Char a, b, c, d;
Cout << “Enter 4 characters: “;
Cin >> a >> b >> c >> d;
Cout << “abcd: “ << a << b << c << d << endl;
Cout << “dcba: “ << d << c << b << a << endl;
Cout << “a b c d: “ << a << “ “ << b << “ “ << c << “ “ << d << endl;
Cout << “ab cd: “ << a << b << “ “ << c << d << endl;
Return 0;
Task 4:
#include <iostream>
Using namespace std;
// Ye program check karta hai ke customer ne apni
// credit limit exceed ki hai ya nahi
// User se account number, balance, charges, credits
// aur credit limit leta hai
// Formula lagata hai
// New Balance = Balance + Charges – Credits
// Agar naya balance limit se zyada ho jaye
// to warning show hojati hai
Int main() {
Int acc_no;
Float balance, charges, credits, limit, new_balance;
Cout << “Enter Account Number: “;
Cin >> acc_no;
Cout << “Enter Beginning Balance: “;
Cin >> balance;
Cout << “Enter Charges: “;
Cin >> charges;
Cout << “Enter Credits: “;
Cin >> credits;
Cout << “Enter Credit Limit: “;
Cin >> limit;
New_balance = balance + charges – credits;
Cout << “New Balance: “ << new_balance << endl;
If (new_balance > limit) {
Cout << “Account Number: “ << acc_no << endl;
Cout << “Credit Limit: “ << limit << endl;
Cout << “New Balance: “ << new_balance << endl;
Cout << “Credit limit exceeded!” << endl;
Return 0;