Lab Report: Prepared By: Saad Ishtiaq Submitting To: Sir Waqar Date: 14/05/2018
Lab Report: Prepared By: Saad Ishtiaq Submitting To: Sir Waqar Date: 14/05/2018
Prepared By:
Saad Ishtiaq
Submitting To:
Sir Waqar
Date: 14/05/2018
LAB MANUAL 3
Task 1
#include<iostream>
#include<conio.h>
int main ()
cin>>amount;
cout<<endl;
cin>>cost;
cout<<endl;
total = cost*amount;
cout<<"total price="<<total<<"rupees"<<endl;
getch ();
}
TASK 2
#include<iostream>
#include<conio.h>
int main ()
int yob,current,age;
cin>>yob;
cout<<"currwent year=";
cin>>current;
age=current-yob;
getch ();
TASK 3
#include<iostream>
#include<conio.h>
int main ()
cin>>tempf;
tempc=(tempf-32)*8*5/9;
cout<<"temperature in celsius="<<tempc<<"degrees"<<endl;
getch ();
TASK 4
#include<iostream>
#include<conio.h>
int main ()
{
int km,m;
cin>>km;
cout<<endl;
m=1000*km;
getch ();
TASK 5
#include<iostream>
#include<conio.h>
int main ()
cin>>pounds;
pounds=0.546*kg;
cout<<"weight in kg's is="<<pounds<<"pounds"<<endl;
cin>>dollar;
rs=114.6*dollar;
cout<<"value of rupees="<<rs<<"rs"<<endl;
getch ();
TASK 6
#include<iostream>
#include<conio.h>
int main ()
float distance,time,velocity;
cout<<"enter distacne=";
cin>>distance;
cout<<endl;
cout<<"enter time=";
cin>>time;
cout<<endl;
velocity=distance/time;
cout<<"velocity of car="<<velocity<<"km\h"<<endl;
getch ();
TASK 7
#include<iostream>
#include<conio.h>
int main ()
int a,vol;
cin>>a;
cout<<endl;
vol=a*a*a;
cout<<"volume="<<vol;
getch ();
TASK 8
#include<iostream>
#include<conio.h>
int main ()
int r;
cout<<"enter radius=";
cin>>r;
float area;
area = pi*r*r;
cout<<"area=";
cout<<area;
getch ();
}
LAB MANUAL 4
TASK 1
#include<iostream>
#include<conio.h>
int main ()
int l,w,peri,area;
cin>>l;
cout<<endl;
cin>>w;
cout<<endl;
area=l*w;
cout<<"area="<<area<<endl;
peri=l+l+w+w;
cout<<"perimeter="<<peri<<endl;
getch ();
}
Task 2
#include<iostream>
#include<conio.h>
#include<iomanip>
int main ()
cout<<"***********"<<endl;
cout<<"*"<<setw(10)<<"*"<<endl;
cout<<"*"<<setw(10)<<"*"<<endl;
cout<<"*"<<setw(10)<<"*"<<endl;
cout<<"*"<<setw(10)<<"*"<<endl;
cout<<"*"<<setw(10)<<"*"<<endl;
cout<<"***********"<<endl;
getch ();
}
TASK 3
#include <iostream>
#include<conio.h>
int main()
char a;
cin >> a;
cout << "ASCII Value of " << a << " is " << int(a);
getch ();
}
TASK 4
#include <iostream>
#include<conio.h>
#include<iomanip>
int main()
cin>>titc;
cout<<endl;
cin>>tpf;
cout<<endl;
cin>>tcal;
cout<<endl;
total= titc+tpf+tcal;
cout<<"total mks="<<total;
cout<<endl;
cout<<"obtained in ITC=";
cin>>mksitc;
cout<<endl;
cout<<"obtained in PF=";
cin>>mkspf;
cout<<endl;
cout<<"obtained in Calculus=";
cin>>mkscal;
cout<<endl;
cout<<setw(45)<<mksitc<<setw(20)<<titc<<endl;
cout<<setw(45)<<mkspf<<setw(20)<<tpf<<endl;
cout<<setw(45)<<mkscal<<setw(20)<<tcal<<endl;
cout<<endl<<endl<<endl;
getch () ;
}
TASK 5
#include <iostream>
#include<conio.h>
int main()
getch ();
}
LAB MANUAL 5
TASK 1
#include<iostream>
#include<conio.h>
#include<iomanip>
int main ()
cout<<"enter radius";
cin>>r;
cout<<endl;
dia= 2*r;
cir= 2*pi*r;
area= pi*r*r;
cout<<"OUTPUT"<<endl;
cout<<endl;
cout<<"Diameter"<<setw(20)<<"2*r"<<setw(20)<<dia<<endl;
cout<<"Circumference"<<setw(20)<<"2*pi*r"<<setw(20)<<cir<<endl;
cout<<"Area"<<setw(20)<<"pi*r*r"<<setw(20)<<area<<endl;
cout<<endl;
getch ();
TASK 2
#include<iostream>
#include<conio.h>
int main ()
int a,b,c;
a=6;
b=8;
c=a;
a=b;
b=c;
cout<<"a=";
cout<<a<<endl;
cout<<"b=";
cout<<b<<endl;
getch ();
LAB MANUAL 7
Task 1
#include<iostream>
#include<conio.h>
#include<iomanip>
int main ()
cout<<setw(5)<<"*";
cout<<endl;
getch ();
TASK 6
#include<iostream>
#include<conio.h>
#include<iomanip>
main()
int i;
cout<<endl<<endl;
int count=1;
cout<<endl<<setw(14);
for( i=1;i<=1;i+=1)
cout<<"*";
cout<<endl<<setw(13);
for( i=1;i<=3;i+=1)
cout<<"*";
cout<<endl<<setw(12);
for( i=1;i<=5;i+=1)
cout<<"*";
cout<<endl<<setw(11);
for( i=1;i<=7;i+=1)
cout<<"*";
cout<<endl<<setw(10);
for( i=1;i<=9;i+=1)
cout<<"*";
cout<<endl;
getch();
}
TASK 3
#include<iostream>
#include<conio.h>
int main ()
int n,rev,rem;
rev=0;
cout<<"enter number=";
cin>>n;
while(n!=0)
rem = n%10;
rev = rev*10+rem;
n/=10;
cout<<"reveresed number="<<rev<<endl;
getch ();
}