Write a switch/case program to calculate 1. Area of a rectangle=L*B 2. Perimeter of a rectangle=2(L+B)
Answers
Answered by
3
#include<iostream.h>
void main ()
{
int L,B,area, perimeter,choice;
cout<<"enter length";
cin>>L;
cout<<"enter breadth";
cin>>B
cout<<"enter choice: 1. area 2.perimeter";
cin>>choice;
switch (choice);
{
case 1:
area = L*B;
cout<<"area of rectangle="<<area;
break;
case 2:
perimeter=2*(L+B);
cout<<"perimeter of rectangle="<<perimeter;
break;
}
}
Similar questions