Lab 5 Report - Lab #5 14 February 2007 Chris Sutherland 11W...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Lab #5 14 February 2007 Chris Sutherland 11W Part 1 1.) There are no real roots. ----Run finished---- 2.) 4 -6 ----Run finished---- 3.) Start "Coefficient A = ?" GET A "Coefficient B = ?" GET B "Coeffecient C = ?" GET C (B ^ 2 - ( 4 * A * C )) < 0 PUT "There are no real roots."¶ Root1 ← ( - B + sqrt(B ^ 2 - 4 * A * C)) / (2 * A); Root2 ← ( - B - sqrt(B ^ 2 - 4 * A * C)) / (2 * A); PUT Root1¶ PUT Root2¶ No Yes End Chris Sutherland EngE 1104 14 Feb 2007 Solves a quadratic formula
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Part 2 1.) % Chris Sutherland % EngE 1104 % Feb. 14, 2006 New_Var = input( 'Enter the coefficients of your equation to find its roots.' ); A = input( 'What is the coefficient in front of the squared term?' ); B = input( 'What is the coefficient in front of the variable?' ); C = input( 'What is the constant?' ); if (B^2 - (4 * A * C))<0 fprintf( 'No real roots.\n' ); else Root1 = (-B + sqrt(B^2 - 4 * A * C))/(2 * A); Root2 = (-B - sqrt(B^2 - 4 * A * C))/(2 * A); fprintf( '\n Root 1 = %f' , Root1); fprintf( '\n Root 2 = %f'
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

Lab 5 Report - Lab #5 14 February 2007 Chris Sutherland 11W...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online