You are on page 1of 14

MAIRA MALIK

REG : BCS223060

INTRODUCTION TO PROGRAMMING
LAB : 03
7.1 PRACTICE TASK 1
INPUT
#include<iostream>
using namespace std;
int main()
{

cout << "########################## \n$$$$ * *************************$$$$\


n*********\\\WELCOME to CUST * ******\n$$$$ * *************************$$$$\
n##########################" << endl;

OUTPUT:
7.2 Practice Task 2
INPUT
#include<iostream>
using namespace std;
int main()
{
cout << "*** My Introduction ***\n* Name: ishraq khan *\n*DOB : 07-08-2003 *\
n*City : bamkhel swabi * *Prog : computer science *\n*The End " << endl;
}

OUTPUT
7.3 Practice Task 3
INTPUT
#include<iostream>
using namespace std;
int main()
{
cout << "Course Code | Course Name | Credit Hour\nCS1114 | ITC | 4\nCS1234 |
Computer Programming | 4\nCS1123 | Cal - I | 4\nCS1121 | Algebra | 3\nCS1124 | Discrete
Maths | 3"<< endl;
}

OUTPUT
7.4 Practice Task 4
INPUT
#include<iostream>
using namespace std;
int main()
{
cout << "Name | Ali\nEmp_no | Emp_123\nSalary | 30000" << endl;
}

OUTPUT
7.5 Practice
Task 5

INPUT
#include<iostream>
using namespace std;
int main()
{
cout << "Month | Num of Hours\nJan | 100\nFeb | 150\nMarch | 130\nApril | 90\nMay
| 110\nJune | 135" << endl;
}

OUTPUT
7.6 Practice Task 6
INPUT
#include<iostream>
using namespace std;
int main()
{
cout << "Allowances | Amount\nHouse Rent | 1000\nMedical | 1500\nTA
/ DA | 2000\nBonus | 50000" << endl;
}

OUTPUT
7.7 Practice Task 7
INPUT
#include<iostream>
using namespace std;
int main()
{

float a;
cout << "Prass any key \a" <<endl;
cin >> a;
}

OUTPUT
7.8 Practice Task 8
INPUT
#include<iostream>
using namespace std;
int main()
{

int a;
cout << "Enter Any number: ";
cin >> a;
cout << "++count =" << ++a << endl;
cout << "count-- =" << a-- << endl;
cout << "count++ =" << a++ << endl;
cout << "--count =" << --a << endl;
}

OUTPUT
7.9 Practice Task 9
INPUT
#include<iostream>
using namespace std;
int main()
{

int a, b;
cout << "Enter 1st number: ";
cin >> a;
cout << "Enter 2st number: ";
cin >> b;
cout << "Addition: "<<a+b<< endl;
cout << "Subtraction: " << a - b << endl;
cout << "Multiplication: " << a * b << endl;
cout << "Divide: " << a / b << endl;
}

OUTPUT
7.10 Practice Task 10
INPUT
#include<iostream>
using namespace std;
int main()
{

int a, b,c,d;
cout << "Enter 1st number: ";
cin >> a;
cout << "Enter 2st number: ";
cin >> b;
cout << "Enter 3st number: ";
cin >> c;
cout << "Enter 4st number: ";
cin >> d;
cout << "\n" << a << "\n" << b << "\n" << c << "\n" << d << endl;
}

OUTPUT
7.11 Practice Task 11
INPUT
a)
#include <iostream>
using namespace std;
int main()
{
float a = 2.0, b = 1.0, c = 5.0, d = 10.0;
int number1 = 5;
a* (b - c / d) + ++number1;

cout << "Result: " << a * (b - c / d) + ++number1 << endl;


}

OUTPUT

b)
INTPUT
#include <iostream>
using namespace std;
int main()

{
int a = 2, b = 1, c = 5, d = 10, Num2 = 4;
int Result;
Result = a + b / c + d + Num2++;
cout << "Result: " << Result << endl;
}

OUTPUT

c)
#include <iostream>
using namespace std;
int main()
{
int m = 4, n = 5, p = 2;
int amount = 2;
(m + n) / (p + amount);
cout << "Result: " << (m + n) / (p + amount) << endl;

OUTPUT

You might also like