Tuesday, September 11, 2018

Homework 2

Height Estimates from in to ft based on Bone Lengths

#include <stdio.h>
#include <math.h>
int main(void)
{

/* Declare variables. */
double femur, humerus, femur_ht_f, femur_ht_m, humerus_ht_f,
humerus_ht_m;
/* Get user input from the keyboard. */
printf("Enter Values in Inches. \n");
printf("Enter femur length: \n");
scanf("%lf",&femur);
printf("Enter humerus length: \n");
scanf("%lf",&humerus);

/* Compute height estimates. */
femur_ht_f = (femur*1.94 + 28.7) / 12;
femur_ht_m = (femur*1.88 + 32) / 12;
humerus_ht_f = (humerus*2.8 + 28.2) / 12;
humerus_ht_m = (humerus*2.9 + 27.9) / 12;
/* Print height estimates. */

printf("\nHeight Estimates in Feet \n");
printf("\nFemur Female Estimate: %5.1f ft\n",femur_ht_f);
printf("Femur Male Estimate: %5.1f ft\n",femur_ht_m);
printf("\nHumerus Female Estimate: %5.1f ft\n",humerus_ht_f);
printf("Humerus Male Estimate: %5.1f ft\n",humerus_ht_m);

/* Exit program. */
return 0;
}


Height Estimates in ft based on Bone Lengths

#include <stdio.h>
#include <math.h>
int main(void)
{

/* Declare variables. */
double femur, humerus, femur_ht_f, femur_ht_m, humerus_ht_f,
humerus_ht_m;
/* Get user input from the keyboard. */

printf("Enter Values in Feet. \n");
printf("Enter femur length: \n");
scanf("%lf",&femur);
printf("Enter humerus length: \n");
scanf("%lf",&humerus);

/* Compute height estimates. */
femur_ht_f = ((femur*1.94*12) + 28.7)/12;
femur_ht_m = ((femur*1.88*12) + 32)/12;
humerus_ht_f = ((humerus*2.8*12) + 28.2)/12;
humerus_ht_m = ((humerus*2.9*12) + 27.9)/12;

/* Print height estimates. */
printf("\nHeight Estimates in Feet \n");
printf("\nFemur Female Estimate: %5.1f ft\n",femur_ht_f);
printf("Femur Male Estimate: %5.1f ft\n",femur_ht_m);
printf("\nHumerus Female Estimate: %5.1f ft\n",humerus_ht_f);
printf("Humerus Male Estimate: %5.1f ft\n",humerus_ht_m);

/* Exit program. */
return 0;
}

Height Estimates in in and ft based on Bone Lengths

#include <stdio.h>
#include <math.h>
int main(void)

{
/* Declare variables. */
double femur, humerus, femur_ht_f_in, femur_ht_m_in, humerus_ht_f_in,
humerus_ht_m_in, femur_ht_f_ft, femur_ht_m_ft, humerus_ht_f_ft,
humerus_ht_m_ft;

/* Get user input from the keyboard. */
printf("Enter Values in Inches. \n");
printf("Enter femur length: \n");
scanf("%lf",&femur);
printf("Enter humerus length: \n");
scanf("%lf",&humerus);

/* Compute height estimates in inches. */
femur_ht_f_in = (femur*1.94 + 28.7);
femur_ht_m_in = (femur*1.88 + 32);
humerus_ht_f_in = (humerus*2.8 + 28.2);
humerus_ht_m_in = (humerus*2.9 + 27.9);

/* Compute height estimates in feet. */
femur_ht_f_ft = (femur*1.94 + 28.7) / 12;
femur_ht_m_ft = (femur*1.88 + 32) /12;
humerus_ht_f_ft = (humerus*2.8 + 28.2) / 12;
humerus_ht_m_ft = (humerus*2.9 + 27.9) / 12;

/* Print height estimates. */
printf("\nHeight Estimates in Inches and also Feet\n");
printf("\nFemur Female Estimate: %5.1f in /%5.2f ft \n", femur_ht_f_in, femur_ht_f_ft);
printf("Femur Male Estimate: %5.1f in /%5.2f ft \n", femur_ht_m_in, femur_ht_m_ft);
printf("\nHumerus Female Estimate: %5.1f in /%5.2f ft\n", humerus_ht_f_in, humerus_ht_f_ft);
printf("Humerus Male Estimate: %5.1f in /%5.2f ft\n", humerus_ht_m_in, humerus_ht_m_ft);

/* Exit program. */
return 0;
}

Height Estimates in in/ft based on Bone Lengths

#include <stdio.h>
#include <math.h>
int main(void)
{

/* Declare variables. */
double femur_in, femur_ft, humerus_in, humerus_ft, femur_ht_f_in, femur_ht_m_in, humerus_ht_f_in,
humerus_ht_m_in, femur_ht_f_ft, femur_ht_m_ft, humerus_ht_f_ft,
humerus_ht_m_ft;

/* Get user input from the keyboard. */
printf("Enter Values in Inches. \n");
printf("Enter femur length: \n");
scanf("%lf",&femur_in);
printf("Enter humerus length: \n");
scanf("%lf",&humerus_in);
printf("\nEnter Values in Feet. \n");
printf("Enter femur length: \n");
scanf("%lf",&femur_ft);
printf("Enter humerus length: \n");
scanf("%lf",&humerus_ft);

/* Compute height estimates in inches. */
femur_ht_f_in = (femur_in*1.94 + 28.7);
femur_ht_m_in = (femur_in*1.88 + 32);
humerus_ht_f_in = (humerus_in*2.8 + 28.2);
humerus_ht_m_in = (humerus_in*2.9 + 27.9);

/* Compute height estimates in feet. */
femur_ht_f_ft = ((femur_ft*12)*1.94 + 28.7);
femur_ht_m_ft = ((femur_ft*12)*1.88 + 32);
humerus_ht_f_ft = ((humerus_ft*12)*2.8 + 28.2);
humerus_ht_m_ft = ((humerus_ft*12)*2.9 + 27.9);

/* Print height estimates. */
printf("\nHeight Estimates in Inches and then Feet\n");
printf("\nFemur Female Estimate: %5.1f in / %5.2f ft \n", femur_ht_f_in, femur_ht_f_ft);
printf("Femur Male Estimate: %5.1f in / %5.2f ft \n", femur_ht_m_in, femur_ht_m_ft);
printf("\nHumerus Female Estimate: %5.1f in / %5.2f ft\n", humerus_ht_f_in, humerus_ht_f_ft);
printf("Humerus Male Estimate: %5.1f in / %5.2f ft\n", humerus_ht_m_in, humerus_ht_m_ft);

/* Exit program. */
return 0;
}

Height Estimates in cm based on Bone Lengths

#include <stdio.h>
#include <math.h>
int main(void)
{

/* Declare variables. */
double femur, humerus, femur_ht_f, femur_ht_m, humerus_ht_f, humerus_ht_m;

/* Get user input from the keyboard. */
printf("Enter Values in Centimeters. \n");
printf("Enter femur length: \n");
scanf("%lf",&femur);
printf("Enter humerus length: \n");
scanf("%lf",&humerus);

/* Compute height estimates in centimeters. */
femur_ht_f = ((femur/2.54)*1.94 + 28.7);
femur_ht_m = ((femur/2.54)*1.88 + 32);
humerus_ht_f = ((humerus/2.54)*2.8 + 28.2);
humerus_ht_m = ((humerus/2.54)*2.9 + 27.9);

/* Print height estimates. */
printf("\nHeight Estimates in Centimeters\n");
printf("\nFemur Female Estimate: %5.2f cm\n", femur_ht_f*2.54);
printf("Femur Male Estimate: %5.2f cm\n", femur_ht_m*2.54);
printf("\nHumerus Female Estimate: %5.2f cm\n", humerus_ht_f*2.54);
printf("Humerus Male Estimate: %5.2f cm\n", humerus_ht_m*2.54);

/* Exit program. */
return 0;
}

Molecular weight of glycine

#include <stdio.h>
#include <math.h>
int main(void)
{

/* Declare variables. */
double oxygen=15.9994, carbon=12.011, nitrogen=14.00674, sulfur=32.066, hydrogen=1.00794, weight_glycine;

/* Compute weight of glycine. */
weight_glycine = 2*oxygen + 2*carbon + nitrogen + 5*hydrogen;

/* Print weight. */
printf("The molecular weight for Glycine is %.4lf amu.", weight_glycine);

/* Exit program. */
return 0;
}

Molecular Weights of Glutamic and Glutamine

#include <stdio.h>
#include <math.h>
int main(void)
{

/* Declare variables. */
double oxygen=15.9994, carbon=12.011, nitrogen=14.00674, sulfur=32.066, hydrogen=1.00794, weight_glutamic, weight_glutamine;

/* Compute weight of glutamic and glutamine. */
weight_glutamic = 4*oxygen + 5*carbon + nitrogen + 8*hydrogen;
weight_glutamine = 3*oxygen + 5*carbon + 2*nitrogen + 10*hydrogen;

/* Print weight. */
printf("The molecular weight for Glutamic is %.4lf amu.\n", weight_glutamic);
printf("\nThe molecular weight for Glutamine is %.4lf amu.", weight_glutamine);

/* Exit program. */
return 0;
}

Molecular Weight of am Amino Acid

#include <stdio.h>
#include <math.h>
int main(void)
{

/* Declare variables. */
double oxygen=15.9994, carbon=12.011, nitrogen=14.00674, sulfur=32.066, hydrogen=1.00794, weight_amino, o_num, c_num, n_num, s_num, h_num;

/*Input number of atoms of amino acid*/
printf("Enter the number of atoms for each element of your amino acid. \n");
printf("Enter number of oxygen atoms: \n");
scanf("%lf",&o_num);
printf("Enter number of carbon atoms: \n");
scanf("%lf",&c_num);
printf("Enter number of nitrogen atoms: \n");
scanf("%lf",&n_num);
printf("Enter number of sulfur atoms: \n");
scanf("%lf",&s_num);
printf("Enter number of hydrogen atoms: \n");
scanf("%lf",&h_num);

/* Compute weight of amino acid. */

weight_amino = (o_num*oxygen) + (c_num*carbon) + (n_num*nitrogen) + (s_num*sulfur) + (h_num*hydrogen);

/* Print weight. */
printf("\nThe molecular weight for your amino acid is %.4lf amu.", weight_amino);

/* Exit program. */
return 0;
}

Average Weight of Elements of Amino Acid

#include <stdio.h>
#include <math.h>
int main(void)
{

/* Declare variables. */
double oxygen=15.9994, carbon=12.011, nitrogen=14.00674, sulfur=32.066, hydrogen=1.00794, o_num, c_num, n_num, s_num, h_num, sum_atoms, average_weight;

/*Input number of atoms of amino acid*/
printf("Enter the number of atoms for each element of your amino acid. \n");
printf("Enter number of oxygen atoms: \n");
scanf("%lf",&o_num);
printf("Enter number of carbon atoms: \n");
scanf("%lf",&c_num);
printf("Enter number of nitrogen atoms: \n");
scanf("%lf",&n_num);
printf("Enter number of sulfur atoms: \n");
scanf("%lf",&s_num);
printf("Enter number of hydrogen atoms: \n");
scanf("%lf",&h_num);

/* Compute weight of amino acid. */
sum_atoms = o_num + c_num + n_num + s_num + h_num;

average_weight = ((o_num*oxygen) + (c_num*carbon) + (n_num*nitrogen) + (s_num*sulfur) + (h_num*hydrogen)) / sum_atoms;

/* Print weight. */
printf("\nThe average weight of the elements for your amino acid is %.4lf amu.", average_weight);

/* Exit program. */
return 0;
}

Kitt Nightrider Blinking

void setup()
{
pinMode(10,OUTPUT);
pinMode(9,OUTPUT);
pinMode(8,OUTPUT);
pinMode(7,OUTPUT);
pinMode(6,OUTPUT); //Initialize Pins
}
void loop()
{
digitalWrite(10,HIGH); //Set the LED
On delay(100); //Wait for 100 ms
digitalWrite(10,LOW); //Set the LED Off

digitalWrite(9,HIGH); //Set the LED On
delay(100); //Wait for 100 ms
digitalWrite(9,LOW); //Set the LED Off

digitalWrite(8,HIGH); //Set the LED On
delay(100); //Wait for 100 ms
digitalWrite(8,LOW); //Set the LED Off

digitalWrite(7,HIGH); //Set the LED On
delay(100); //Wait for 100 ms
digitalWrite(7,LOW); //Set the LED Off

digitalWrite(6,HIGH); //Set the LED On
delay(100); //Wait for 100 ms
digitalWrite(6,LOW); //Set the LED Off

digitalWrite(7,HIGH); //Set the LED On
delay(100); //Wait for 100 ms
digitalWrite(7,LOW); //Set the LED Off

digitalWrite(8,HIGH); //Set the LED On
delay(100); //Wait for 100 msms
digitalWrite(8,LOW); //Set the LED Off

digitalWrite(9,HIGH); //Set the LED On
delay(100); //Wait for 100 ms
digitalWrite(9,LOW); //Set the LED Off

No comments:

Post a Comment