uri 2342 solution in cpp
by ujjal roy
#include<bits/stdc++.h>
using namespace std;
main()
{
int a,b,r,n;
char c;
cin>>n;
cin>>a>>c>>b;
if(c=='+') r=a+b;
else if(c=='*') r=a*b;
if(r>n) cout<<"OVERFLOW"<<endl;
else cout<<"OK"<<endl;
return 0;
}
uri 2342 solution in cpp
by ujjal roy
#include<bits/stdc++.h>
using namespace std;
main()
{
int a,b,r,n;
char c;
cin>>n;
cin>>a>>c>>b;
if(c=='+') r=a+b;
else if(c=='*') r=a*b;
if(r>n) cout<<"OVERFLOW"<<endl;
else cout<<"OK"<<endl;
return 0;
}
0 Comments