Advertisement
Raul_julian

Calculadora-[OBI]

Jun 17th, 2013
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.32 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     int N, x;
  6.     double num, result=1;
  7.     char oper[100000];
  8.    
  9.     scanf("%d", &N);
  10.    
  11.         for(x=0; x<N; x++) {
  12.    
  13.         scanf("%lf %c", &num, &oper[x]);
  14.    
  15.         if(oper[x]=='/') {
  16.    
  17.         result = result/num; }
  18.  
  19.         else { result = result*num; }}
  20.  
  21.     printf("%.0lf", result);
  22.    
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement