2013-03-18T11:44:53-04:00
write a program in c++ to find out the area of a right angle triangle
1
2013-03-28T11:36:51-0400
#include <iostream> int main() { //show message and enter first leg of triangle std::cout <<"Enter first leg of right triangle\n"; float a=0; std::cin >>a; //show message and enter second leg of triangle std::cout <<"Enter second leg of right triangle\n"; float b=0; std::cin >>b; float area=0; //if input correct then calculate an area else show error message if( ( a>0 ) && (b>0) ) { area=a*b*0.5; std::cout <<"Area=" <<area <<"\n"; } else { std::cout <<"Input error!\n"; } return 0; }
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS !
Learn more about our help with Assignments:
C++
Comments