Skip to main content

Molecular weight of Organic Compound in c


INRODUCTION:

The Organic Compounds means carbon compounds, this are divided based on structure and functional group. Based structure organic compounds are divided into Alkyl compound and Aryl (Aromatic) compounds. Based on functional group organic compounds divided into Alkyl or Aryl Halides, Alcohols, Phenols and Ethers, Aldehydes, Ketones and Nitriles compounds. Alkyl or Aryl Halides means the carbon compound consist of functional group of Chlorine, Bromine, Iodine. Alcohols means here the carbon consists of –OH functional group attached to carbon. Phenol means – OH is attached to Benzene ring. Ethers(R-O-R’) are the derivate of alcohols and phenols, they are formed by the substitution of –H in –OH. Aldehydes and ketones are organic compounds which incorporate carbonyl functional group, C=O. Nitrile(-NH 2 ) compounds means Alkyl and Aryl derivates of ammonia formed by the replacement of one or more hydrogen atom by corresponding number of alkyl and aryl or both groups. In this project we find the molecular weight of an organic compound by using c –programing.

AIM OF THE PROJECT:

To determine the molecular weight of the organic compound by using C-program. In this program we are mainly going to calculate the molecular weights of following compounds.
1.Molecular Weight of Alkyl Halide (Carbon Tetra Chloride (CCl 4 ))
2.Molecular weight of ethyl alchol (C 2 H 5 OH)
3. Molecular Weight of Methyl Amine (CH 3 NH 2 )

METHODOLOGY
For the determination of molecular weight of the organic compound their different method like Dumas method etc. by this method we can find the weights practically. Theoretically we can find molecular weight by adding each compound molecular weight to find whole molecular weight based on the theoretical method here I am going to calculate the molecular weight using C-programming. In C-programming I am switch cases concept because organic compounds are many types like Halides, Alcohols, Phenols, Ethers, Aldehydes, ketones and Nitriles to find weight of all this compound I used concept of switch cases here all the compound molecular weight inputted in floating constant. In this program first we need to select the type of compound and the we enter the no of moles compounds of each type and then molecular weight is printed.


Code for the Determination of Molecular weight of Organic Compound

#include<stdio.h>
#include<math.h>
void main()
{
float carbon,hydrogen,oxygen,chlorine,bromine,iodine,nitrogen,molecularweight,c,h,o,cl,br,i,n;
int I;
printf("\t 1.The Compound is Alkyl or Aryl halide\n");
printf("\t 2.The Compound is Alchol or Phenol or Ester or Aldehyde or Ketone \n");
printf("\t 3.The Compound is Amine\n");
scanf("%d",&I);
switch(I)
{
case 1:
carbon=12;
hydrogen=1;
oxygen=16;
chlorine=35.5;
bromine=79.904;
iodine=126.90447;
printf("\t Enter no of molecules of Carbon atom\n");
scanf("%f",&c);
printf("\t Enter no of molecues of Hydrogen atom\n");
scanf("%f",&h);
printf("\t Enter no of molecues of Oxygen atom\n");
scanf("%f",&o);
printf("\t Enter no of molecues of Chlorine atom\n");
scanf("%f",&cl);
printf("\t Enter no of molecues of Bromine atom\n");
scanf("%f",&br);
printf("\t Enter no of molecues of Iodine atom\n");
scanf("%f",&i);
molecularweight=c*carbon+h*hydrogen+o*oxygen+cl*chlorine+br*bromine+i*iodine;
break;
case 2:
carbon=12;
hydrogen=1;
oxygen=16;
printf("\t Enter no of molecules of Carbon atom\n");
scanf("%f",&c);
printf("\t Enter no of molecues of Hydrogen atom\n");
scanf("%f",&h);
printf("\t Enter no of molecues of Oxygen atom\n");
scanf("%f",&o);
molecularweight=c*carbon+h*hydrogen+o*oxygen;
break;
case 3:
carbon=12;
hydrogen=1;
oxygen=16;
nitrogen=14;
printf("\t Enter no of molecules of Carbon atom\n");
scanf("%f",&c);
printf("\t Enter no of molecues of Hydrogen atom\n");
scanf("%f",&h);
printf("\t Enter no of molecules of Oxygen atom\n");
scanf("%f",&o);
printf("\t Enter no of molcules of Nitrogen atom\n");
scanf("%f",&n);
molecularweight=c*carbon+h*hydrogen+o*oxygen+n*nitrogen;
break ;
}
printf("Molecular Weight= %f",molecularweight);
}
Results and discussion
At the end of the program we get molecular weight of givenorganic compound, here we find the molecular weight using C –programming we
find the molecular weight of the organic compound using a concept of switch cases basing on the theoretical method.
Conclusion
In this project I found molecular weight of the organic compound by using C-programming.


Comments

Popular

DBMS LAB MANUAL

Programly Special's DBMS LAB MANUAL CLICK HERE TO DOWNLOAD

pattern problem in c with output 12345 4321 123 21 1

#include <stdio.h> int main(void) {     int f=5;     int w=5; for(int i=1;i<=5;i++) {     if(i%2!=0){         for(int h=1;h<=f;h++){             printf("%d",h);         }         f=f-1;         w=w-1;         printf("\n");     }     if(i%2==0){         for(int r=w;r>0;r--)         {             printf("%d",r);         }     w=w-1;     f=f-1;     printf("\n");     } } return 0; } output:- 12345                                                            ...

COMPUTER NETWORKS OSI LAYERS

Programly Special's A Video on OSI Layers in computer networks (cn)