review 1 version F ee3aeR

review 1 version F ee3aeR - d printf ("Input M...

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

View Full Document Right Arrow Icon
Sheet1 Page 1 1) (110011001)2 to Decimal 1 * 2^0 = 1 0 * 2^1 = 0 0 * 2^2 = 0 1 * 2^3 = 8 1 * 2^4 = 16 0 * 2^5 = 0 0 * 2^6 = 0 1 * 2^7 = 128 1 * 2^8 = 256 -------------- = 409 (12545)8 to Decimal 5 * 8^0 = 5 4 * 8^1 = 32 5 * 8^2 = 256 2 * 8^3 = 1024 1 * 8^4 = 4096 --------------- = 5413 2) A) print out 3.142 exactly? printf("Approximate value of PI = %4.3f\n", PI) What would %15.2f print? 15 digits wide with 2 digits of precision to the right-hand side of the decimal point Approximate value of PI= 3.14 2) B) both statements are right since they make each statment right 2) C) #include <math.h> directive is used to make the compiler scan the header file at the start of the source file. its functions are abs(x), acos(x), asin(x), atan(x). ................. yes you can multiply and divide with out the #include <math.h> header, as long as you have the #include <stdlib.h> header 3)
Background image of page 1

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

View Full DocumentRight Arrow Icon
Sheet1 Page 2 #include <stdio.h> #include <math.h> int main(void) { double G = 9.8 float fM, fm, fr double Force
Background image of page 2
Background image of page 3

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

View Full DocumentRight Arrow Icon
Background image of page 4
Background image of page 5

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

View Full DocumentRight Arrow Icon
Background image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: d printf (&quot;Input M \n&quot;) scanf (&quot;%f&quot;, &amp;fM) printf (&quot;Input m \n&quot;) scanf (&quot;%f&quot;, &amp;fm) printf (&quot;Input r \n&quot;) scanf (&quot;%f&quot;, &amp;fr) Force = ((G * fM * fm)/ (fr * fr)) printf (&quot;The Force is %lf \n&quot;, Force) p Force = ((G * fM * fm)/ (((fr*.5) * (fr*.5)))) printf (&quot;The Second Force is %lf \n&quot;, Force) p Force = ((G * fM * fm)/ (((fr *.25) * (fr * .25)))) printf (&quot;The Third Force is %lf \n&quot;, Force) getchar() return (0) r } 4) #include &lt;stdio.h&gt; #include &lt;math.h&gt; int main(void) { float fK1, fK2 double Output1 double Output2 printf (&quot;Input K 1 \n&quot;) scanf (&quot;%f&quot;, &amp;fK1) printf (&quot;Input K 2 \n&quot;) scanf (&quot;%f&quot;, &amp;fK2) Output1 = (fK1 + fK2) Output2 = ((fK1 * fK2)/(fK1 + fK2)) O if (Output2 &gt; Output1) { printf (&quot;The lowest output 2 is %lf \n&quot;, Output1) } Sheet1 Page 3 else if (Output2 == Output1) {printf(&quot;same\n&quot;) } else{ printf (&quot;The lowest output 1 is %lf \n&quot;, Output2) p return 0 } Sheet1 Page 4 Sheet1 Page 5 Sheet1 Page 6 }...
View Full Document

Page1 / 6

review 1 version F ee3aeR - d printf (&amp;amp;quot;Input M...

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

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