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

Programming Fundamentals Lab Assignments

This document contains a programming lab assignment submitted by Zeemal Fatima, detailing various C++ programs. The programs include calculations for the sum of two variables, area of geometric shapes, value swapping techniques, currency conversion between USD and PKR, and converting minutes to seconds. Each program is presented with its code implementation and output instructions.

Uploaded by

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

Programming Fundamentals Lab Assignments

This document contains a programming lab assignment submitted by Zeemal Fatima, detailing various C++ programs. The programs include calculations for the sum of two variables, area of geometric shapes, value swapping techniques, currency conversion between USD and PKR, and converting minutes to seconds. Each program is presented with its code implementation and output instructions.

Uploaded by

zeemalhms
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Programming Fundamental Lab

Assignment 1
Submitted by: Zeemal Fatima
Submitted to: Nabeel Ali Khan

Program#1
Display the sum of two variables.

(a):
#include<iostream>
using namespace std;
int main(){
int a=10, b=20;
int sum;
sum= a+b;
cout<<sum;
}

(b):
#include<iostream>
using namespace std;
int main(){
int a=10, b=20;
int sum;
sum= a+b;
cout<<"sum= "<<sum;
}

Program#2:
Display area of square.

#include<iostream>
using namespace std;
int main(){
float L=10, W=20;
float area;
area= L*W;
cout<<"area= "<<area;
}

Program#3:
Displays area of triangle.

#include<iostream>
using namespace std;
int main(){
float b=10, h=20;
float area;
area= 0.5*b*h;
cout<<"area= "<<area;
}

Program#4:
Displays area of circle.

#include<iostream>
using namespace std;
int main(){
float r=10;
float area;
area= 3.14*r*r;
cout<<"area= "<<area;
}

Program#5:
Swap values of two variables using a third program.

(a):

#include<iostream>
using namespace std;
int main(){
int a=10, b=20, c=0;
c= a;
a= b;
b=c;
cout<<a<<b;
}

(b):
#include<iostream>
using namespace std;
int main(){
int a=10, b=20, c=0;
c= a;
a= b;
b=c;
cout<<a<<"\t"<<b;
}

Program#6
Swap values of two variables without using a third variable.

(a):
#include<iostream>
using namespace std;
int main(){
int a=10, b=20;
a= a+b;
b= a-b;
a= a-b;
cout<<a<<"\n"<<b;
}

(b):
#include<iostream>
using namespace std;
int main(){
int a, b;
cout<<"enter values";
cin>>a>>b;
a= a+b;
b= a-b ;
a= a-b;
cout<<a<<"\n"<<b;
}

Program#7
Convert amount in USD into PKR.
#include<iostream>
using namespace std;
int main(){
float amount, usd;
cout<<"enter amount in usd";
cin>>amount;
usd= amount*282;
cout<<"amount in pkr= "<<usd;

Program#8
Convert amount in PKR into USD.

#include<iostream>
using namespace std;
int main(){
float amount, pkr;
cout<<"enter amount in pkr";
cin>>amount;
pkr= amount/282;
cout<<"amount in usd= "<<pkr;

Program#9
Convert minutes into second.

#include<iostream>
using namespace std;
int main(){
float mint, sec;
cout<<"enter mint";
cin>>mint;
sec= mint*60;
cout<<"sec= "<<sec;

You might also like