CHE 210 HW1 Solution

# CHE 210 HW1 Solution - %0.1f\n,n fprintf\nFinal...

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

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

View Full Document
% Determines the Balance in a savings account % with an interest Rate expressed in percent, % an Initial balance after N years. A = input('Initial Investment: '); r = input('Interest Rate (percent): '); n = input('Number of Years: '); B = A*(1+r/100)^n; fprintf('\nInitial Balance: %0.2f\n',A); fprintf(' Interest Rate: %0.1f\n',r); fprintf('Number of Years:
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: %0.1f\n',n); fprintf('\nFinal Balance: %0.2f\n',B); >> interest Initial Investment: 10000 Interest Rate (percent): 4.3 Number of Years: 5 Initial Balance: 10000.00 Interest Rate: 4.3 Number of Years: 5.0 Final Balance: 12343.02 >> interest Initial Investment: 5000 Interest Rate (percent): 6 Number of Years: 6 Initial Balance: 5000.00 Interest Rate: 6.0 Number of Years: 6.0 Final Balance: 7092.60 % Determines the angle between sides a and b of % a triangle using law of cosines. a = input('Enter Side A: '); b = input('Enter Side B: '); c = input('Enter Side C: '); % Could solve as a single assignment cosgamma = (a^2 + b^2 - c^2)/(2*a*b); angle = acosd( cosgamma ); fprintf('\nA: %3d B: %3d C: %3d\n', a , b, c ); fprintf('Angle: %0.2f\n',angle); >> triangle_angle Enter Side A: 18 Enter Side B: 35 Enter Side C: 50 A: 18 B: 35 C: 50 Angle: 139.00 >> triangle_angle Enter Side A: 3 Enter Side B: 4 Enter Side C: 5 A: 3 B: 4 C: 5 Angle: 90.00...
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern