class_notes7

0 rate year 21 printf 4d212fn year amount 22

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: uot;%lf", &principle ); printf( "Enter the annual interest rate: " ); scanf( "%lf", &rate ); Example Program: Compound Interest printf( "\n%4s%21s\n", "Year", "Amount in account" ); 18 19 for ( year = 1 ; year <= 10 ; year++ ) { 20 amount = principle * pow( 1.0 + rate, year ); 21 printf( "%4d%21.2f\n", year, amount ); 22 } 23 24 return 0; /* indicate that program ended successfully */ 25 26 27 } /* end function main */ Temperature Conversion For some people (like Canadians) it is difficult to get used to using some US units of measurement. For example, they always have to convert temperature readings from ˚F to units that make much more sense, like ˚C. Consider a library, defined in “conv_lib.h” that has functions that performs conversions. Use the function FtoC() to print a conversion chart that displays the converted temperature over a specified range and interval. Develop an appropriate algor...
View Full Document

This note was uploaded on 08/06/2010 for the course ENGR 3 taught by Professor Ben-yaakov during the Summer '08 term at UCSB.

Ask a homework question - tutors are online