HW2 day 2
1Write a program to compute and print the molecular weight of glycine.
1Write a program to compute and print the molecular weight of glycine.
#include <stdio.h>
#include <math.h>
int main(void)
{
/* Declare variables. */
double O, C, N, S,H,Glycine;
printf("\nEnter Aminoacid name \n ");
scanf("%fl",&Glycine );
C= 12.011 , O=15.9994 ,N=14.00674 ,S=32.066 ,H=1.00794;
Glycine= 2*(O+C)+N+5*H;
printf("weight Estimate: %6.5f \n",Glycine);
/* Exit program. */
return 0;
}
2. Write a program to compute and print the molecular weights of glutamic and glutamine.
#include <stdio.h>
#include <math.h>
int main(void)
{
/* Declare variables. */
double O, C, N, S,H,Glutamic,Glutamine;
printf("Enter Values name. \n");
printf("Enter Glutamic: \n");
scanf("%lf",&Glutamic);
printf("Enter Glutamine: \n");
scanf("%lf",&Glutamine);
C= 12.011 , O=15.9994 ,N=14.00674 ,S=32.066 ,H=1.00794;
Glutamic= (4*O)+(5*C)+N+(8*H);
Glutamine=(3*O)+(5*C)+(2*N)+(10*H);
printf("\nweight Estimates \n");
printf("Glutamic weight:% 6.5f \n ", Glutamic);
printf("weight Glutamine:%6.5f\n ", Glutamine);
/* Exit program.*/
return 0;
}
3. Write a program that asks the user to enter the number of atoms of each of the five elements for an amino acid. Then compute and print the molecular weight for this amino acid.
4. Write a program that asks the user to enter the number of atoms of each of the five elements for an amino acid. Then compute and print the average weight of the atoms in the amino acid.
#include <stdio.h>
#include <math.h>
int main(void)
{
/* Declare variables. */
double a,b,c,d,e,O, C, N, S,H,Alamine,weight;
/* Get user input from the keyboard. */
printf("Enter number atom . \n");
printf("Enter number of O: \n");
scanf("%lf",&a);
printf("Enter number of C: \n");
scanf("%lf",&b);
printf("Enter number of N: \n");
scanf("%lf",&c);
printf("Enter number of S: \n");
scanf("%lf",&d);
printf("Enter number of H: \n");
scanf("%lf",&e);
/* Compute height estimates. */
C= 12.011 , O=15.9994 ,N=14.00674 ,S=32.066 ,H=1.00794;
weight=b*C+a*O+c*N+d*S+e*H;
/* Print height estimates. */
printf("\nweight Estimates \n");
printf("Alamine: %6.5f \n",weight);
/* Exit program. */
return 0;
}
#include <stdio.h>
#include <math.h>
int main(void) {
/*declare variables.*/
double a, b, c, d, e,average,O,C,N,S,H;
/* Get user input from the keyboard. */
printf("Enter number of atoms. \n");
printf("Enter number of O: \n");
scanf("%lf",&a);
printf("Enter number of C: \n");
scanf("%lf",&b);
printf("Enter number of N: \n");
scanf("%lf",&c);
printf("Enter number of S: \n");
scanf("%lf",&d);
printf("Enter number of H: \n");
scanf("%lf",&e);
/* Compute number.*/
average=(a*15.9994+b*12.0111+c*14.00674+d*32.066+e*1.00794)/(a+b+c+d+e);
printf("average of atoms in amino acid: %5.2f\n",average);
return 0;
}
Comments
Post a Comment