Code:
//hi experts,
  //              i can't get the following code to read in  multiple times after the 
"more(y/n)" printout. it does not scan a second time it just exists the loop after just once 
//can you please fix the bug in this simple program.

char op = 'y';

while(op == 'y') 
 {    
  printf("Enter formula: ");
  scanf("%s",molecule);
 
  l = strlen(molecule);

  calc_weight(element,s,molecule,l);
 
 printf("More? (y/n) : "); // THIS DOES NOT WORK???
 scanf("%c",&op);       //      WHY???????

 }
 

return 0;    
    
}

Last edited by shabbir; 27Jun2011 at 21:30.. Reason: Code blocks