Program1

# Program1 - Shayon Mazumder [email protected]/* <![CDATA[ */!function(t,e,r,n,c,a,p){try{t=document.currentScript||function(){for(t=document.getElementsByTagName('script'),e=t.length;e--;)if(t[e].getAttribute('data-cfhash'))return t[e]}();if(t&&(c=t.previousSibling)){p=t.parentNode;if(a=c.getAttribute('data-cfemail')){for(e='',r='0x'+a.substr(0,2)|0,n=2;a.length-n;n+=2)e+='%'+('0'+('0x'+a.substr(n,2)^r).toString(16)).slice(-2);p.replaceChild(document.createTextNode(decodeURIComponent(e)),c)}p.removeChild(t)}}catch(u){}}()/* ]]> */ CS101 Program 1 Problem Create a program that calculates the area of a right triangle Algortithim

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

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