Starting from:

$30

CSC60- Lab 3 printf practice Solved

Problem:



Practice writing printf statements.

You will write several printf statements to achieve the results below, including the line spacing.  There is no room for creativity in this assignment. I want you to be able to control your print output to a specification. Use the quote that is given below.

Start your code with (Approximate the number of dashes):

                             /*--------------*/

/* Your Name    */

/* Lab 3        */

#include <stdio.h

#include <stdlib.h

int main(void)

{         int age = 22;    // You must use this variable         double average = 246.23689;

•       Obviously, your output (shown below) will not say bielr on it. 

•       I want the line spacing just as it appears below.

•       Yes, you may move the starting brace to the end of the line above if you desire.

•       Write one printf for each line that appears below. 

•       Regarding the quote and its attribution, you may do it in either one or two printf statements. 

•       Do not use a different quote for this assignment.

•       When printing the friend’s age, write the printf so it will only print 2 digits.

•       When printing average, you must use both a  total  width  and the after-the-decimal-point value in your conversion specifier.

•       Remember to print your name and “Lab 3” in the output.

Output:



[bielr@athena lab3] a.out

Ruthann Biel. Lab 3.

Jane went to the store.

My friend is 22 years old.

"So many books, so little time."

- Frank Zappa

The average = 246.2

The average = 246.237

The average = 2.46e+02

 [bielr@athena lab3]

More products