0% found this document useful (0 votes)
4 views8 pages

Computer Science Practical

This document outlines the practical journal for Computer Science for Class XII under the Agha Khan University Examination Board. It includes various programming tasks such as using if statements, nested if statements, switch statements, and different types of loops in C++. Each practical task is accompanied by example code demonstrating the required programming concepts.

Uploaded by

arsalan.jaan.x0
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)
4 views8 pages

Computer Science Practical

This document outlines the practical journal for Computer Science for Class XII under the Agha Khan University Examination Board. It includes various programming tasks such as using if statements, nested if statements, switch statements, and different types of loops in C++. Each practical task is accompanied by example code demonstrating the required programming concepts.

Uploaded by

arsalan.jaan.x0
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/ 8

For Annual

Examination 2025

PRACTICAL JOURNAL

Computer Science
For Class XII-AKU-E

According to Agha khan University Examination


Board (AKU-EB)

Programming
DEPARTMENT OF COMPUTER SCIECNE

CERTIFICATE

Seat No

It is Certified that Mr/Miss

S/O,D/O

of H.S.C Part-II has completed the necessary practical work as prescribed by


AGA KHAN UNIVERSITY EXAMINATION BOARD (AKU-EB) in the Computer
Science Lab of Boys/Girls

Head of Department Subject Teacher

Date
PRACTICAL # 01
SLO # 12.1.2

Write a program for each if, if-else and else-if.


if Statement:

#include <iostream>
using namespace std;
int main() {
int age;
cout<<"Enter Your Age: "<<endl;
cin>>age;
if (age >= 18) {
cout << "You are Eligible for Vote." << endl;}
return 0;}
if-else Statement:
#include <iostream>
using namespace std;
int main() {
int n;
cout<<"Enter a Integer: "<<endl;
cin>>n;
if (n > 0) { cout << "You Entered a Positive Number.";}
else { cout << "You Entered a Negative Number.";}
return 0;}

else-if Statement:
#include <iostream>
using namespace std;
int main() {
int marks;
cout<<"Enter your Obtained Marks (out of 100): "<<endl;
cin>>marks;
if (marks >= 90) {cout << "Grade: A" << endl;}
else if (marks >= 80) {cout << "Grade: B" << endl;}
else if (marks > 60) {cout << "Grade: C" << endl;}
else if (marks <= 60) {cout << "You are Pass." << endl;
return 0;}

PRACTICAL # 02
12.1.3:
Write a program using a nested if statement.
#include <iostream>
using namespace std;
int main() {
int rows = 5;
for (int i = 1; i <= rows; i++) {
for (int j = 1; j <= i; j++) {
cout << "*";}
cout << endl;}
return 0;}

PRACTICAL # 03
SLO # 12.1.5
Write a program using the switch statement.
#include <iostream>
using namespace std;
int main() {
int day;
cout << "Enter a number (1-7):"<<endl;
cin >> day;
switch (day) {
case 1:
cout << "Monday" << endl; break;
case 2:
cout << "Tuesday" << endl; break;
case 3:
cout << "Wednesday" << endl; break;
case 4:
cout << "Thursday" << endl; break;
case 5:
cout << "Friday" << endl; break;
case 6:
cout << "Saturday" << endl; break;
case 7:
cout << "Sunday" << endl; break;
default:
cout << "Invalid input!"<< endl; }return 0;}

PRACTICAL # 04
SLO # 12.2.2
Write a C++ program that uses for loop.
#include <iostream>
using namespace std;
int main(){
for (int i = 1; i <= 5; i++) {
cout<< "PAKISTAN" <<endl;}
return 0;}

PRACTICAL # 05
SLO # 12.2.3
Write a C++ program that uses while loop.
#include <iostream>
using namespace std;
int main() {
int number = 1;
while (number <= 10) {
cout << " " << number << endl;
number++;}
return 0;}

PRACTICAL # 06
SLO # 12.2.4
Write a C++ program that uses do while loop.
#include <iostream>
using namespace std;
int main() {
int number = 0;
do {
cout << " " << number<< endl;
number=number+2;}
while (number <= 10);
return 0;}

You might also like