Sie sind auf Seite 1von 12

LAB ASSIGNMENT NO.

1
SUBMITTED TO SIR ALI USMAN
SUBMITTED BY MUHAMMAD SHAHEER DURRANI
REGISTRATION NO. CIIT/FA19-BCS-111/SWL
COURSE INTRODUCTION TO COMPUTER
PROGRAMMING
DEPARTMENT COMPUTER SCIENCE
DATE OF SUBMISSION 26 SEPTEMBER 2019

COMSATS UNIVERSITY ISLAMABAD,


SAHIWAL CAMPUS
(1) C++ PROGRAM TO FIND AREA OF CIRCLE.
#include<iostream>
using namespace std;
int main()
{
int radius, area;
cout<<”Enter the radius”<<endl;
cin>>radius;
area=3.14*radius*radius;
cout<<”Area of the circle :”<<area<<endl;
return 0;
}
(2) C++ PROGRAM TO FIND AREA OF RECTANGLE.
#include<iostream>
using namespace std;
int main()
{
int length, breath, area;
cout<<”Enter the length of Rectangle”<<endl;
cin>>length;
cout<<”Enter the breath of Rectangle”<<endl;
cin>>breath;
area=length*breath;
cout<<”Area of the Rectangle :”<<area<<endl;
return 0;
}
(3) C++ PROGRAM TO FIND AREA OF TRIANGLE.
#include<iostream>
using namespace std;
int main()
{
int height, base, area;
cout<<”Enter Height :”<<endl;
cin>>height;
cout<<”Enter Base :”<<endl;
cin>>base;
area=(0.5)*height*base;
cout<<”Area of the Triangle :”<<area<<endl;
return 0;
}
(4) C++ PROGRAM TO CONVERT CELSIUS INTO FAHRENHEIT.
#include<iostream>
using namespace std;
int main()
{
float fahrenheit, celsius;
cout<<”Enter the temperature in Celsius:”<<endl;
cin>>celsius;
fahrenheit=(celsius * 9.0) / 5.0 + 32;
cout<<”The temperature is celsius :”<<celsius<<endl;
cout<<”The temperature is Fahrenheit :”<<fahrenheit<<endl;
return 0;
}
(5) C++ PROGRAM TO FIND PARAMETER OF RECTANGLE.
#include<iostream>
using namespace std;
int main()
{
int length, breath, parameter;
cout<<”Enter the length of Rectangle”<<endl;
cin>>length;
cout<<”Enter the breath of Rectangle”<<endl;
cin>>breath;
parameter=2*(length*breath);
cout<<”Parameter of the Rectangle :”<<parameter<<endl;
return 0;
}
(6) C++ PROGRAM TO FIND VOLUME OF A CUBE.
#include<iostream>
using namespace std;
int main()
{
int side, volume;
cout<<”Enter the side of a cube”<<endl;
cin>>side;
volume=(side*side*side);
cout<<”Volume of the cube :”<<volume<<endl;
return 0;
}
(7) C++ PROGRAM TO FIND CIRCUMFERENCE OF A CIRCLE.
#include<iostream>
using namespace std;
int main()
{
int radius, circumference;
cout<<”Enter the radius”<<endl;
cin>>radius;
circumference=2*3.14*radius;
cout<<”Circumference of the circle :”<<circumference<<endl;
return 0;
}
(8) C++ PROGRAM TO FIND THE DIAMETER OF A CIRCLE.
#include<iostream>
using namespace std;
int main()
{
int radius, diameter;
cout<<”Enter the radius”<<endl;
cin>>radius;
diameter=2*radius;
cout<<”Diameter of the circle :”<<diameter<<endl;
return 0;
}
(9) C++ PROGRAM TO AREA OF A RHOMBUS.
#include<iostream>
using namespace std;
int main()
{
int diag_1, diad_2, area ;
cout<<”Enter diagonals of the rohmbus”<<endl;
cin>>diag_1<<diag_2;
area=(0.5)* diag_1* diag_2;
cout<<”Area of the Rohmbus :”<<area<<endl;
return 0;
}
(10) C++ PROGRAM TO FIND THE AREA OF A PARALLELOGRAM.
#include<iostream>
using namespace std;
int main()
{
int base,height, area;
cout<<”Enter Base”<<endl;
cin>>base;
cout<<”Enter Height”<<endl;
cin>>height;
area=base*height;
cout<<”Area of the Parallelogram :”<<area<<endl;
return 0;
}

Das könnte Ihnen auch gefallen