UVA Solution 465 - Overflow - Solution in C,C++ - Online Judge Solution

Latest

It is a free Online judges problems solution list. Here you can find UVA online Judge Solution, URI Online Judge Solution, Code Marshal Online Judge Solution, Spoz Online Judge Problems Solution

Friday, May 19, 2017

UVA Solution 465 - Overflow - Solution in C,C++

UVA Solution 465 - Overflow - Solution in C,C++

UVA Online Judge Solution 465 - Overflow | Volume 4
UVA Problem Link - 465 - Overflow

Problem Name: 465 - Overflow Solution
Problem Number : UVA - 465 - Overflow Code
Online Judge : UVA Online Judge Solution
Volume: 4
Solution Language : C plus plus

UVA Online Judge Solution, UVA OJ Solution list, UVA Problems Solution, UVA solver, UVA all problem solution list

UVA Solution 465 - Overflow Code in C/CPP:

#include<stdio.h>
int main() {
    double a, b;
    int INF = 2147483647;
    char op, s[2000];
    while(gets(s)) {
  printf("%s\n", s);
  sscanf(s, "%lf %c %lf", &a, &op, &b);
  if(a > INF)
   puts("first number too big");
  if(b > INF)
   puts("second number too big");
  if(op == '+' && a+b > INF)
   puts("result too big");
  if(op == '*' && a*b > INF)
   puts("result too big");
    }
    return 0;
}


Tags: UVA Online Judge Solution, UVA OJ Solution list, UVA Problems Solution, UVA solver, UVA all problem solution list, UVA 465 code in C, UVA 465 - Overflow  code in C++, UVA 465 - Overflow solution in C, UVA 465 solution

No comments:

Post a Comment