Free Essay

Heyhey

In:

Submitted By
Words 320
Pages 2
//PTASK5

#include <iostream>
Using namespace std;

Int main ()
{

Float a; //a=Length
Float b; //b=width
Float area, perimeter;

cout <<”This program computes for the area of a Rectangle and perimeter”; <<endl;

cout <<”Enter Length: “; cin >>a;

cout <<”Enter Width: “; cin>>b;

area=a*b; perimeter=2*(a+b) cout <<”Area: ”<<area<<endl; cout <<”Perimeter: ”<<perimeter<<endl;

return 0;
}

//PTASK6

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

float length, width; float acm, ain, aft, amtr; //acm=area cm, ain= area inch, aft=area feet, amtr= area meter float pcm, pin, pft, pm; //pcm=perimeter cm, pin=perimeter in, pft=perimeter feet,
//pm= perimeter meter

cout<<"Input Length of the Square in cm:"; cin>>le ngth; cout<<"Input Width of the Square in cm:"; cin>>width;

//AREA FORMULA acm=length*width; ain=acm*2.54; aft=ain*12; am=aft*3.28;

//cout area cout<<"Area of a Square:"<<endl; cout<<acm<<"sq.cm"<<endl; cout<<ain<<"sq.in"<<endl; cout<<aft<<"sq.ft"<<endl; cout<<am<<"sq.m"<<endl<<endl; //PERIMETER pcm=2*(length+width); pin=pcm*2.54; pft=pin*12; pm=pft*3.28;

//cout perimeter cout<<"Perimeter of a Square:"<<endl; cout<<pcm; cout <<"sq.cm"<<endl; cout<<pin; cout<<"sq.in"<<endl; cout<<pft; cout<<"sq.ft"<<endl; cout<<pm; cout<<"sq.m"<<endl;

cout<<endl;

return 0; }