Computer Science 1511
Computer Science I
Homework Assignment 4 (10 points)
Due October 6, 1999 at the start of recitation

  1. Show the output for this program fragment (make sure to indicate space characters):
    	int x = -5;
    	float y = 3.14159;
    	char z = 'X';
    	printf("We the %c People \nin Order to %-5d form a more",z,x);
    	printf("perfect\n\n%7.3f  %1.4fuNiOn",y,y);
    	printf("%3c establish justice, \n%06d insure domestic %.2f",'B',5,3.119);
  2. Given the following declarations
    	int I;
    	float R;
    	char C1, C2;

    Assume that the user types this input below to the keyboard (where spaces are shown as underscore '_' characters) for each of the scanf commands below:

    	- 4 2 . 0 _ _ 1 3 _ O _ X

    Show the contents of the variables assuming the user types the above line for each scanf:

           scanf(" %f %d %c %c",&R,&I,&C1,&C2);   I:___  R:____  C1:___  C2:___
           scanf("%f %c%d%c",&R,&C1,&I,&C2);      I:___  R:____  C1:___  C2:___
           scanf("%c %d %f %c",&C2,&I,&R,&C1);    I:___  R:____  C1:___  C2:___
  3. Page 99 Problem #4