0% found this document useful (0 votes)
27 views

Lab Task 0-Roll No-11

Uploaded by

sardaradhan85
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)
27 views

Lab Task 0-Roll No-11

Uploaded by

sardaradhan85
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/ 28

PROGRAMMING

FUNDAMENTALS
LAB TASK 0

Submitted to: sir tayyab arshad


Submitted by: Areeba Qayyum
Roll no: 11
Department: information technology

[DATE]
FACULTY OF COMPUTING AND ENGINEERING
Session 2022-2026
PROGRAMMING FUNDAMENTALS

Lab 03: Escape sequence and variable arithematic

Progam 01:
#include<iostream>
using namespace std;
int main()
{
cout<<" ##########################"<<endl;
cout<<"$$$$******************************$$$$"<<endl;
cout<<"********\\\\\WELCOME to CUST********"<<endl;
cout<<"$$$$******************************$$$$"<<endl;
cout<<" ##########################"<<endl;
return 0;

1
PROGRAMMING FUNDAMENTALS

Program 02:
#include <iostream>

using namespace std;

int main()

cout<<"***MY INTRODUCTION***"<<endl;

cout<<" * Name: areeba qayyum *"<<endl;

cout<<"*DOB: 06 june 2003 *"<<endl;

cout<<"city: Kotli * *Prog: Your Prog *"<<endl;

cout<<" * THE END *"<<endl;

return 0;

2
PROGRAMMING FUNDAMENTALS

Program 03:
#include<iostream>

using namespace std;

int main()

cout<<"course code\t|\tcourse Name\t| credit Hour"<<endl;

cout<<"CS1114\t|\tICT\t \t| 4"<<endl;

cout<<"CS1234\t|\tProgramming\t| 4"<<endl;

cout<<"CS1123\t|\tCal-1\t | 4"<<endl;

cout<<"CS1121\t|\tAlgebra\t | 3"<<endl;

cout<<"CS1124\t|\tDiscrete Maths\t| 3"<<endl;

return 0;

3
PROGRAMMING FUNDAMENTALS

Program:04
#include<iostream>

using namespace std;

int main()

cout<<"NAME\t|\tAROOSHA"<<endl;

cout<<"Emp_no\t|\tEmp_123"<<endl;

cout<<"Salary\t|\t30000"<<endl;

return 0;

4
PROGRAMMING FUNDAMENTALS

Program 05:
#include<iostream>

using namespace std;

int main()

cout<<"MONTH | Num of Hours"<<endl;

cout<<"Jan | 100"<<endl;

cout<<"Feb | 150"<<endl;

cout<<"March | 130"<<endl;

cout<<"April | 90"<<endl;

cout<<"May | 110"<<endl;

cout<<"June | 135"<<endl;

return 0;

5
PROGRAMMING FUNDAMENTALS

Program 06:
#include<iostream>

using namespace std;

int main()

cout<<"Allowances | Amount"<<endl;

cout<<"House Rent | 1000"<<endl;

cout<<"Medical | 1500"<<endl;

cout<<"TA/DA | 2000"<<endl;

cout<<"Bonus | 50000"<<endl;

return 0;

6
PROGRAMMING FUNDAMENTALS

Program 07:
#include<iostream>

using namespace std;

int main()

cout<<"First Print Then beep \a";

return 0;

7
PROGRAMMING FUNDAMENTALS

Program 08:
#include<iostream>

using namespace std;

int main()

int x;

cout<<"Enter a number: ";

cin>>x;

cout<<++x<<endl;

cout<<--x<<endl;

cout<<x++<<endl;

cout<<x--<<endl;

return 0;

8
PROGRAMMING FUNDAMENTALS

Program 09:
#include<iostream>

using namespace std;

int main()

int a,b;

cout<<"Enter number1: ";

cin>>a;

cout<<"Enter number2: ";

cin>>b;

cout<<"a+b= "<<a+b<<endl;

cout<<"a-b= "<<a-b<<endl;

cout<<"a*b= "<<a*b<<endl;

cout<<"a/b= "<<a/b<<endl;

return 0;

9
PROGRAMMING FUNDAMENTALS

Program 10:
#include<iostream>

using namespace std;

int main()

cout<<"4\n5\6\n7\n8";

return 0;

10
PROGRAMMING FUNDAMENTALS

Lab 04: Control structures and relational operators


Program 01:
#include<iostream>

using namespace std;

int main()

int age;

cout<<"Enter age: ";

cin>>age;

if(age<=70){

cout<<"pension will be 30000"<<endl;

else{

cout<<"pension will be 40000"<<endl;

return 0;

11
PROGRAMMING FUNDAMENTALS

Program 02:
#include<iostream>
using namespace std;
int main()
{
int marks;
cout<<"Enter Marks: ";
cin>>marks;
if(marks>90)
cout<<"Grade A"<<endl;
else if((marks>=86)&&(marks<=90))
cout<<"Grade A-";
else if((marks>=81)&&(marks<86))
cout<<"Grade B";
else if((marks>=77)&&(marks<81))
cout<<"Grade B";
else if((marks>=72)&&(marks<77))
cout<<"Grade B-";
else if((marks>=68)&&(marks<72))
cout<<"Grade C+";
else if((marks>=63)&&(marks<68))
cout<<"Grade C";

12
PROGRAMMING FUNDAMENTALS

else if((marks>=58)&&(marks<63))
cout<<"Grade C-";
else if((marks>=54)&&(marks<58))
cout<<"Grade D+";
else if((marks>=50)&&(marks<54))
cout<<"Grade D";
else
cout<<"Fail";
return 0;
}

13
PROGRAMMING FUNDAMENTALS

Program 03:
#include<iostream>
using namespace std;
int main() {
int counting;
cout << "Enter the number to show the month=";
cin >> counting;
switch(counting)
{
case 1:
cout <<" January";
break;
case 2:
cout <<"February";
break ;
case 3:
cout << "Marach";
break;
case 4:
cout << "April";
break;
case 5:

14
PROGRAMMING FUNDAMENTALS

cout << "May";


break;
case 6:
cout << "June";
break;
case 7:
cout <<"July";
break;
case 8:
cout <<"August";
break;
case 9:
cout <<"September";
break;
case 10:
cout <<"October";
break;
case 11:
cout << "November";
break;
case 12:
cout << "December";

15
PROGRAMMING FUNDAMENTALS

break;
}
return 0;
}

Program 4:
Write a program to input a number from the user the program display
weather the number divisible by 3 or not.
#include<iostream>
using namespace std;
int main()
{ int x;
cout <<"Enter a number =";

16
PROGRAMMING FUNDAMENTALS

cin >> x;
if(x%3==0)
cout <<"\n All Number is divisible by 3\n";
else
cout <<" All Number is not divisible by 3";
return 0;
}

17
PROGRAMMING FUNDAMENTALS

Program 05:
#include<iostream>
using namespace std;
int main()
{
int x,y;
cout<<"Enter number 1: ";
cin>>x;
cout<<"Enter number 2: ";
cin>>y;
if(x>=y)
cout<<"Number 1 is maximum";
else
cout<<"Number 2 is maximum";
return 0;
}

18
PROGRAMMING FUNDAMENTALS

LAB 05
Program 01:
#include<iostream>
using namespace std;
int main()
{
int inc,max=100000,min=1000;
for(int i=1;i<=10;i++)
{
cout<<"Enter"<<i<<"employee salary=";
cin>>inc;
if(max<inc)
max=inc;
if(min>inc)
min=inc;
}
cout<<"\nThe mximum salary is "<<max;
cout<<"\nThe minimum salary is "<<min;
return 0;
}

19
PROGRAMMING FUNDAMENTALS

Program 02:
#include<iostream>
using namespace std;
int main()
{
int days,choice;
cout<<"Enter the number of days= ";
cin>>days;
cout<<"What do you want?\n1.convert hours\n2.Convert into
minutes"<<endl;
cin>>choice;
switch(choice)
{
case 1:
cout<<"The hour in days"<<days*24;
break;
case 2:
cout<<"The minutes in days"<<days*24*60;
break;
}
return 0;

20
PROGRAMMING FUNDAMENTALS

Program 03:
#include<iostream>
using namespace std;
int main()
{
int a,b,c;
cout<<"ENTER first number= ";
cin>>a;
cout<<"ENTER second number= ";
cin>>b;
cout<<"ENTER third number= ";
cin>>c;
if((c>=b)&&(c>=a))
{
cout<<"The max number is "<<c<<endl;
cout<<"Te min number is "<<a;
}
else if((a>=b)&&(a>=c))
{
cout<<"The max number is "<<a<<endl;
cout<<"The min number is "<<b;
}
else
{
cout<<"The max number is "<<b<<endl;
21
PROGRAMMING FUNDAMENTALS

cout<<"Te min number is "<<c;


}
return 0;
}

Program 04:
#include<iostream>

using namespace std;

int main()

int number;

for(int x=1;x<=10;x++)

cout<<"Enter the "<<x<<" Number= ";

cin>>number;

if((number%5==0)||(number%2!=0))

cout<<number<<",";

22
PROGRAMMING FUNDAMENTALS

cout<<"is odd and its divided by 5"<<endl;

return 0;

23
PROGRAMMING FUNDAMENTALS

LAB 06
Program 01:
#include<iostream>
using namespace std;
int main()
{
int m,n,result=1;
cout<<"Enter a number= ";
cin>>m;
cout<<"how many time you want to multiple?"<<endl;
cin>>n;
for(int i=1;i<=n;i++)
{
result=result*m;
}
cout<<"Result is "<<result;
return 0;
}

24
PROGRAMMING FUNDAMENTALS

Program 02:
#include<iostream>
using namespace std;
int main()
{
int n;
cout<<"Enter a number= ";
cin>>n;
for(int i=1;i<=n;i++)
{
cout<<i<<"\t The square is "<<i*i<<endl;
}
return 0;
}

25
PROGRAMMING FUNDAMENTALS

Program 03:
#include<iostream>
using namespace std;
int main()
{
for(int x=3;x<=60;x++)
{
if(x%3==0)
cout<<x<<",";
}
cout<<" Is all the multiples of three";
return 0;
}

26
PROGRAMMING FUNDAMENTALS

Program 04:
#include<iostream>
using namespace std;
int main()
{
int row,c,n,temp;
n=5;
temp=n;
for(row=1;row<=n;row++)
{
for(c=1;c<=temp;c++)
cout<<" ";
temp;
for(c=1;c<=2*2-1;c++)
cout<<"*";
cout<<"\n";
}
return 0;
}

27

You might also like