Advertisement
rdsedmundo

[OBI] overflow.c

May 30th, 2013
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.33 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main() {
  4.     int Over, num[2];
  5.     char OP;
  6.  
  7.     scanf("%d %d %c %d", &Over, &num[0], &OP, &num[1]);
  8.  
  9.     int Result;
  10.     Result = (OP=='*')?(num[0]*num[1]):(num[0]+num[1]);
  11.  
  12.     if(Result > Over) {
  13.             printf("OVERFLOW");
  14.     } else {
  15.             printf("OK");
  16.     }
  17.  
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement