Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Lab-4

#include <iostream>

using namespace std;

int main()

system("color F0");

int num1 = 21;

int num2 = 10;

if (num1 == num2)

cout << "Line-1: Num1 is equal to num2" << endl;

else

cout << "Line-1: Num1 is not equal to num2" << endl;

if (num1 < num2)

cout << "Line-2: Num1 is less than num2" << endl;

else

cout << "Line-2: Num1 is not less than num2" << endl;

if (num1 > num2)

cout << "Line-3: Num1 is greater than num2" << endl;

return 0;

}
Lab-4

Practice Task 1:
#include<iostream>

using namespace std;

int main()

cout << "Enter the employee type : " << endl;

cout << "1.Retired one's" << endl;

cout << "2.Employed one's" << endl;

int option;

cout << "\nEnter your option: ";

cin >> option;

if (option == 1)

cout << "\nEnter the age of the employee: ";

int age;

cin >> age;

if (age >= 60 && age <= 70)

cout << "\nThe retired employee age is: " << age << endl;

cout << "The pension of the employee is: 30000" << endl;

else if (age > 70)

cout << "\nThe retired employee age is: " << age << endl;

cout << "The pension of the employee is: 40000" << endl;
Lab-4

else

cout << "\nThe age you have entered is not valid for a retired employee, it's too low" <<
endl;

else if (option == 2)

cout << "\nEnter the number of hours worked per day: ";

int hours;

cin >> hours;

int pay;

int extra_pay = 0;

if (hours == 8)

pay = 1000;

else if (hours > 8)

if (hours > 11)

pay = 1000;

extra_pay = 3 * 300;

else {

pay = 1000;

int extra_hours = hours - 8;

extra_pay = extra_hours * 300;

cout << "\nThe number of hours worked by the employee is: " << hours << endl;

int total_pay = pay + extra_pay;


Lab-4

cout << "The total pay for the employee is: " << total_pay;

else

cout << "\nInvallid option please try again" << endl;

return 0;

Practice Task2:
#include<iostream>

using namespace std;

int main()

int marks;
Lab-4

cout << "\nEnter Marks: ";

cin >> marks;

if (marks > 90)

cout << "\nGrade A";

else if (marks >= 86 && marks < 90)

cout << "\nGrade A-";

else if (marks >= 81 && marks < 86)

cout << "\nGrade B+";

else if (marks >= 77 && marks < 81)

cout << "\nGrade B";

else if (marks >= 72 && marks < 77)

cout << "\nGrade B-";

else if (marks >= 68 && marks < 72)

cout << "\nGrade C+";

else if (marks >= 63 && marks < 68)

cout << "\nGrade C";

else if (marks >= 58 && marks < 63)


Lab-4

cout << "\nGrade C-";

else if (marks >= 54 && marks < 58)

cout << "\nGrade D+";

else if (marks >= 50 && marks < 54)

cout << "\nGrade D";

else

cout << "\nGrade F";

return 0;

You might also like