{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

HW2_ruzmora

# HW2_ruzmora - int main(void Declare variables double Tf=0...

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

Sheet1 Page 1 /* Chapter 3 Problem 18 */ /* This program will convert from radians to degrees */ #include <stdio.h> #define PI 3.141593 int main(void) { /* Declare and initialize variables */ int degrees double radians=0 /* print radians and degrees */ printf("radians to degrees \n") do { degrees = radians * 180/PI printf("%9.6f %6i \n", radians, degrees) radians += PI/10 } while (radians <= 2*PI) /* Pause program */ getchar() getchar() /* Exit program */ return 0 } /* Chapter 3 Problem 21 */ /* This program will convert from miles per hour to feet per second */ #include <stdio.h>

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

View Full Document
Sheet1 Page 2 #include <math.h> int main(void) { /* Declare and initialize variables */ double mph=0 double ftps /* print miles per hour and feet per second */ printf("mph to feet per second \n") do { ftps = (mph * 5280) / 3600 printf("%6.2f %6.2f \n", mph, ftps) mph += 5 } while (mph <= 65) /* Pause program */ getchar() getchar() /* Exit program */ return 0 } /* Chapter 3 Problem 27 */ /* This program will convert from Fahrenheit to Celcius */ #include <stdio.h> #include <math.h>

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

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

Unformatted text preview: int main(void) { /* Declare variables */ double Tf=0 Sheet1 Page 3 double Tc /* print Fahrenheit to Celcius */ printf(&amp;quot;Fahrenheit to Celcius \n&amp;quot;) while (Tf &amp;lt;= 100) { Tc = (Tf - 32) * 5/9 printf(&amp;quot;%6.2f %6.2f \n&amp;quot;, Tf, Tc) Tf += 5 } /* Pause program */ getchar() getchar() /* Exit program */ return 0 } /* Chapter 3 Problem 29 */ /* This program will convert from Celcious to Rankin */ #include &amp;lt;stdio.h&amp;gt; #include &amp;lt;math.h&amp;gt; int main(void) { /* Declare and initialize variables */ int c, increment, Tc, k double Tr /* User input with the keyboard */ printf(&amp;quot;Enter starting tempereture in degree Celcius: \n&amp;quot;) scanf(&amp;quot;%i&amp;quot;, &amp;amp;c) Sheet1 Page 4 printf(&amp;quot;Enter the increment value: \n&amp;quot;) scanf(&amp;quot;%i&amp;quot;, &amp;amp;increment) s /* Compute and print the table */ printf(&amp;quot;\n&amp;quot;) printf(&amp;quot;Celcius to Rankin \n&amp;quot;) for(k=0 k&amp;lt;25 k++) { Tc = c + k * increment Tr = (1.8 * Tc) + 491.67 printf(&amp;quot;%i %6.2f \n&amp;quot;, Tc, Tr) printf(&amp;quot;\n&amp;quot;) } /* Pause program */ getchar() getchar() /* Exit program */ return 0 }...
View Full Document

{[ snackBarMessage ]}

### Page1 / 4

HW2_ruzmora - int main(void Declare variables double Tf=0...

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

View Full Document
Ask a homework question - tutors are online