Computer science
· 1) Write a statement that reads 5 successive integers into these variables that have already been declared : x1 x2 x3 x4 x5 . Then write a statement that prints each out on its own line so that they form a right-justified column with a 5-digit width. If any of the integers are 5-digits in size, then they will start at the very beginning of their lines. For example: |54213
· | 8713
· | 23
· | 147
· | 15
· NOTE: The vertical bar, | , on the left above represents the left edge of the print area; it is not to be printed out. Also, we show x in the output above to represent spaces-- your output should not actually have x's!
·
· 2) Given three variables , a, b, c, of type double that have already been declared and initialized , write some code that prints each of them in a 15 position field on the same line, in such away that scientific (or e-notation or exponential notation) is avoided. Each number should be printed with 5 digits to the right of the decimal point. For example, if their values were 24.014268319, 14309, 0.00937608, the output would be: |xxxxxxx24.01427xxxx14309.00000xxxxxxxx0.00938 NOTE: The vertical bar, | , on the left above represents the left edge of the print area; it is not to be printed out. Also, we show x in the output above to represent spaces-- your output should not actually have x's!
· 3) Given three variables , a, b, c, of type double that have already been declared and initialized , write a statement that prints each of them on the same line, separated by one space, in such away that scientific (or e-notation or exponential notation) is avoided. Each number should be printed with 5 digits to the right of the decimal point. For example, if their values were 4.014268319, 14309, 0.00937608, the output would be: |4.01427x14309.00000x0.00938
· NOTE: The vertical bar, | , on the left above represents the left edge of the print area; it is not to be printed out. Also, we show x in the output above to represent spaces-- your output should not actually have x's!
·
· 4) Given three variables , k, m, n, of type int that have already been declared and initialized , write some code that prints each of them in a 9 position field on the same line. For example, if their values were 27, 987654321, -4321, the output would be: |xxxxxxx27987654321xxxx-4321
· NOTE: The vertical bar, | , on the left above represents the left edge of the print area; it is not to be printed out. Also, we show x in the output above to represent spaces-- your output should not actually have x's!
· 5) Given three variables , k, m, n, of type int that have already been declared and initialized , write some code that prints each of them left-justified in a 9-position field on the same line. For example, if their values were 27, 987654321, -4321, the output would be: |27xxxxxxx987654321-4321xxxx
· NOTE: The vertical bar, | , on the left above represents the left edge of the print area; it is not to be printed out. Also, we show x in the output above to represent spaces-- your output should not actually have x's!
· 6) Given six variables , a1, b1, a2, b2, a3, b3, of type double that have already been declared and initialized , write some code that prints their values (in the order given above) in 15-position columns. The values of the "a" variables are printed in the first column, those of the "b" variables in the second column. Each value is displayed in a way that avoids scientific (also called exponential notation or e-notation) and in each case there are five digits shown after the decimal point, regardless of the value . For example, if the values of a1, a2, a3 were 1, 2, 3 respectively and the values of b1, b2, b3 were 0.000000814, 26890, 123.456 respectively
· 7) Write a program that asks for five test scores. The program should calculate the average test score and display it. The number displayed should be formatted in fixed-point notation, with one decimal point of precision. Here is one sample run: Enter five test scores: 84 75 90 88 96 Average=86.6
· 8) Write a program that asks the user for an angle, entered in radians. The program should then display the sine, cosine, and tangent of the angle. (Use the sin, cos, and tan library functions to determine these values .) All numeric values in the output should be displayed in fixed-point notation, rounded to four decimal places of precision. Here is one sample run: Enter angle: 1.07078 sin(1.07078)=0.8776