Lab 2 Source Code

lab-2.1-1.c


Either cut-and-paste the following into your lab, or

lab-2.1-1.c

/* student name here */
/* today's date here */
/* ET2560 – instructor's name here */

#include <stdio.h>

int main(void){
    double dist_in_miles, dist_in_kms;

    printf("Convert miles to kilometers\n");
    printf("Please enter the distance in miles: ");
    scanf("%lf", &dist_in_miles);
    dist_in_kms = 1.609 * dist_in_miles;
    printf("The distance in kilometers is: ");
    printf("%f", dist_in_kms);

    return (0);
}

lab-2.1-2.c

Either cut-and-paste the following into your lab, or

lab-2.1-2.c

/* student name here */
/* today's date here */
/* ET2560 – instructor's name here */

#include <stdio.h>

int main(void){
    int days;
    days = 8;

    printf("Hello world!\n");
    printf("I have been studying programming for %d days!\n", days);

    return (0);
}