0% found this document useful (0 votes)
5 views2 pages

Lab 10

C++ Labs

Uploaded by

Muhammad Anas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Lab 10

C++ Labs

Uploaded by

Muhammad Anas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

ICT Lab Report - Lab Manual 10

Student Name: _______Anus__________________ Sign: .


Registra on Number: ____CPEN241101028_______
Student Class: ____Computer Lab_______________ Marks: .
Instructor Name: ____Sir Sanan Ahmed__________
Date of Submission: __05-DEC-2024______________

Lab 10: Conditional Structures if-else


Task 1: Print "Pass" if marks > 40
Code:

#include <iostream>
using namespace std;

int main() {
int marks;
cout << "Enter marks: ";
cin >> marks;

if (marks > 40) {


cout << "Pass" << endl;
}

return 0;
}

Task 2: Print "Pass" or "Fail" based on marks


Code:
#include <iostream>
using namespace std;

int main() {
int marks;
cout << "Enter marks: ";
cin >> marks;

if (marks > 40) {


cout << "Pass" << endl;
} else {
cout << "Fail" << endl;
}

return 0;
}
Task 3: Display "Excellent", "Good", or "Bad" based on marks
Code:

#include <iostream>
using namespace std;

int main() {
int marks;
cout << "Enter marks: ";
cin >> marks;

if (marks > 80) {


cout << "Excellent" << endl;
} else if (marks > 60) {
cout << "Good" << endl;
} else {
cout << "Bad" << endl;
}

return 0;
}

You might also like