Write an algorithm to find area and perimeter of a rectangle
Answers
Answered by
1
main algo
float l (length) , b (breadth), c;
switch ( n)
{
case 1 :
cin>>"enter length">>l;
cin>>"enter breadth">>b;
c =l×b ;
cout<<" area is "<<c;
break;
case2 :
cin>>"enter length">>l;
cin>>"enter breadth">>b;
c =2(l + b);
cout<<" perimeter is "<<c;
break;
}
float l (length) , b (breadth), c;
switch ( n)
{
case 1 :
cin>>"enter length">>l;
cin>>"enter breadth">>b;
c =l×b ;
cout<<" area is "<<c;
break;
case2 :
cin>>"enter length">>l;
cin>>"enter breadth">>b;
c =2(l + b);
cout<<" perimeter is "<<c;
break;
}
Similar questions