c program assignment
Question Description
Revisit your program for assignment 1. Modify it so that the user can enter the number of elements for Oxygen, Carbon, Nitrogen, Sulfur, and Hydrogen and then your program outputs the matching amino acid and molecular weight. Your program should only be able to match one of the following from Table 2.8:
- Asparagine
- Glutamine
- Glycine
- Methionine
- Valine
If your program cannot match the molecules to an amino acid, it outputs “No Match Found”.
For example:
Enter the number of Molecules (O, C, N, S, H): 2, 2, 1, 0, 5
The matching amino acid is Glycine. Its molecular weight is ???.??
Note: ???.?? should be replaced with the molecular weight for the amino acid
Assignment #1
#include <stdio.h>
#define OXYGEN 15.9994
#define CARBON 12.011
#define NITROGEN 14.00674
#define HYDROGEN 1.00794
int main()
{
double glycine;
double glutamic;
double glutamine;
glycine = 2*OXYGEN + 2*CARBON + NITROGEN + 5*HYDROGEN;
glutamic = 4*OXYGEN + 5*CARBON + NITROGEN + 8*HYDROGEN;
glutamine = 3*OXYGEN + 5*CARBON + 2*NITROGEN + 10*HYDROGEN;
printf(“The molecular weight of glycine is %4.2f n”,glycine);
printf(“The molecular weight of glutamic is %4.2f n”,glutamic);
printf(“The molecular weight of glutamine is %4.3f n”,glutamine);
return 0;
}
Get your college paper done by experts
Do my question How much will it cost?Place an order in 3 easy steps. Takes less than 5 mins.
Leave a Reply
Want to join the discussion?Feel free to contribute!