<!-- hamlet
<!-- copytar
examples/                                                                                           0040755 0001107 0000172 00000000000 05660216420 0014270 5                                                                                                    ustar 00zachary                         cs-teach                        377777770000457                                                                                                                                                                        examples/block1.c                                                                                   0100644 0001107 0000172 00000001340 05660207664 0015614 0                                                                                                    ustar 00zachary                         cs-teach                        377777770000457                                                                                                                                                                        #include <stdio.h>
#include <math.h>

/* This program simulates a frictionless block sliding down an inclined
   plane.  The block begins sliding at time 0.  The program prompts the
   user for the angle of the plane and the current time, and reports the
   distance along the plane of the block from its starting point. */


void main () {

  float theta, time, position;

  printf("Enter the angle of the block (in radians): ");
  scanf("%f", &theta);

  printf("Enter the time (in seconds): ");
  scanf("%f", &time);

  if (time <= 0) {
    printf("The position of the block is 0.\n");
  }
  else {
    position = .5 * 9.8 * sin(theta) * time * time;
    printf("The block is %g meters from its starting point.\n", position);
  }

}
                                                                                                                                                                                                                                                                                                examples/block2.c                                                                                   0100644 0001107 0000172 00000001714 05660207671 0015620 0                                                                                                    ustar 00zachary                         cs-teach                        377777770000457                                                                                                                                                                        #include <stdio.h>
#include <math.h>

/* This program simulates a frictionless block sliding down a finite
   inclined plane.  The block begins sliding at time 0.  The program
   prompts the user for the angle of the plane, the distance from the
   block's starting point to the bottom of the plane, and the current
   time.  It reports the distance along the plane of the block from
   its starting point. */


void main () {

  float theta, time, length, position;

  printf("Enter the angle of the block (in radians): ");
  scanf("%f", &theta);

  printf("Enter the length of the plane (in meters): ");
  scanf("%f", &length);

  printf("Enter the time (in seconds): ");
  scanf("%f", &time);

  if (time <= 0) {
    printf("The position of the block is 0.\n");
  }
  else {
    position = .5 * 9.8 * sin(theta) * time * time;
    if (position > length) {
      position = length;
    }
    printf("The block is %g meters from its starting point.\n", position);
  }

}
                                                    examples/block3.c                                                                                   0100644 0001107 0000172 00000002241 05660216244 0015611 0                                                                                                    ustar 00zachary                         cs-teach                        377777770000457                                                                                                                                                                        #include <stdio.h>
#include <math.h>

/* This program simulates a block sliding down a finite inclined
   plane.  The block begins sliding at time 0.  The program prompts
   the user for the angle of the plane, the distance from the block's
   starting point to the bottom of the plane, the coefficient of
   friction, and the current time.  It reports the distance along the
   plane of the block from its starting point. */


void main () {

  float theta, time, length, mu, position, factor;

  printf("Enter the angle of the block (in radians): ");
  scanf("%f", &theta);

  printf("Enter the length of the plane (in meters): ");
  scanf("%f", &length);

  printf("Enter the coefficient of friction: ");
  scanf("%f", &mu);

  printf("Enter the time (in seconds): ");
  scanf("%f", &time);

  factor = sin(theta) - cos(theta)*mu;

  if (time <= 0) {
    printf("The position of the block is 0.\n");
  }
  else if (factor <= 0) {
    printf("The position of the block is 0.\n");
  }
  else {
    position = .5 * 9.8 * factor * time * time;
    if (position > length) {
      position = length;
    }
    printf("The block is %g meters from its starting point.\n", position);
  }

}
                                                                                                                                                                                                                                                                                                                                                               examples/block4.c                                                                                   0100644 0001107 0000172 00000002145 05660216376 0015623 0                                                                                                    ustar 00zachary                         cs-teach                        377777770000457                                                                                                                                                                        #include <stdio.h>
#include <math.h>

/* This program simulates a block sliding down a finite inclined
   plane.  The block begins sliding at time 0.  The program prompts
   the user for the angle of the plane, the distance from the block's
   starting point to the bottom of the plane, the coefficient of
   friction, and the current time.  It reports the distance along the
   plane of the block from its starting point. */


void main () {

  float theta, time, length, mu, position, factor;

  printf("Enter the angle of the block (in radians): ");
  scanf("%f", &theta);

  printf("Enter the length of the plane (in meters): ");
  scanf("%f", &length);

  printf("Enter the coefficient of friction: ");
  scanf("%f", &mu);

  printf("Enter the time (in seconds): ");
  scanf("%f", &time);

  factor = sin(theta) - cos(theta)*mu;

  if ((time <= 0) || (factor <= 0)) {
    printf("The position of the block is 0.\n");
  }
  else {
    position = .5 * 9.8 * factor * time * time;
    if (position > length) {
      position = length;
    }
    printf("The block is %g meters from its starting point.\n", position);
  }

}
is %g meters from its starting point.\n", position);
  }

}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               