Program1 - Shayon Mazumder [email protected] CS101 Program 1 Problem Create a program that calculates the area of a right triangle Algortithim

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: /* Shayon Mazumder [email protected] CS101 Program 1 Problem: Create a program that calculates the area of a right triangle. Algortithim: inputs: leg1, leg2 output: area of triangle refined algorithim //obtain lengths from user //prompt user for lengths //get data //compute area of triangle area of triangle= .5*leg1*leg2 //display area of triangle #include<iostream> usingnamespace std; intmain() { float leg1,leg2; float area_triangle; cout<<"Enter the base of the triangle:"<<endl; cin>> leg1; cout<<"Enter the height of the triangle:"<<endl; cin>> leg2; //compute area of triangle area_triangle=.5*leg1,leg2; //display area of triangle cout<<endl<<"The area of the triangle is:"<<area_triangle<<endl; return 0; } ...
View Full Document

This note was uploaded on 09/20/2010 for the course DS 6351321365 taught by Professor Sdffsd during the Spring '09 term at Acadia.

Ask a homework question - tutors are online