Posts

Showing posts from September, 2017

Day 4 HW

// Selections // PRINTS OUT 753 #include <stdio.h> void main() {   int a = 750;     if(a > 750)   {     if (a >= 1000)     {       a = 0;     }     else     {       if (a < 500)       {         a *=2;       }       else       {         a *=10;       }     }   }   else   {       a += 3;   }     printf(" %4.1d \n", a);   }

Day 3 Mods and HW

#1 SALINITY /*–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––*/ /*  This program uses linear interpolation to                  */ /*  compute the freezing temperature of seawater.              */ #include <stdio.h> #include <math.h> int main(void) { /*  Declare variables.  */ double a, f_a, b, f_b, c, f_c; /*  Get user input from the keyboard.  */ printf("Use ppt for salinity values. \n"); printf("Use degrees F for temperatures. \n"); printf("Enter first salinity and freezing temperature: \n"); scanf("%lf %lf",&a,&f_a); printf("Enter second salinity and freezing temperature: \n"); scanf("%lf %lf",&c,&f_c); printf("Enter new salinity: \n"); scanf("%lf",&b); //  Use linear interpolation to compute   new freezing temperature.           f_b = f_a + (b-a)/(c-a)*(f_c - f_a); /* ...

Day 3 Lab / Lecture

/* Day 3 lecture / lab work freezing */ /*–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––*/ /*  This program uses linear interpolation to                  */ /*  compute the freezing temperature of seawater.              */ #include <stdio.h> #include <math.h> int main(void) { /*  Declare variables.  */ double a, f_a, b, f_b, c, f_c; /*  Get user input from the keyboard.  */ printf("Use ppt for salinity values. \n"); printf("Use degrees F for temperatures. \n"); printf("Enter first salinity and freezing temperature: \n"); scanf("%lf %lf",&a,&f_a); printf("Enter second salinity and freezing temperature: \n"); scanf("%lf %lf",&c,&f_c); printf("Enter new salinity: \n"); scanf("%lf",&b); //  Use linear interpolation to compute   new freezing temperature.           f_b = f_a + (b-a)...