Author Topic: what answer is right in this case :)  (Read 210 times)

Offline karadev

  • Single posting newcomer
  • *
  • Posts: 4
what answer is right in this case :)
« on: September 04, 2018, 02:11:39 pm »
#include <iostream>
using namespace std;
int main()
{
    // all values are size type int

    int a = 3522;
    int b = 52355;
    int c = 23;
    int d = 2336;
    int e = 501;
    int f = 23432;
    int g = 6743;
    int h = 3;
    long result = 0;
    long result2 = 0;

    result2 = (3522+52353)*23 - (2336*501 + 23432 - 6743)*3;
    // console output result2 = -2275950

    result = ((a+b)*c) - (((d*e)+(f-g))*h);
    // console output result = -2275904

    cout << result2 << "\n";
    cout << result << "\n";
    cout << "press ENTER key for end";

    getchar();

    return 0;
}
« Last Edit: September 04, 2018, 02:14:07 pm by karadev »

Offline sodev

  • Almost regular
  • **
  • Posts: 163
Re: what answer is right in this case :)
« Reply #1 on: September 04, 2018, 02:38:17 pm »
Both are correct. What have i won?

Offline Miguel Gimenez

  • Multiple posting newcomer
  • *
  • Posts: 112
Re: what answer is right in this case :)
« Reply #2 on: September 04, 2018, 03:25:45 pm »
The value of b is different, anyway this is OT here

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6295
    • My Best Post
Re: what answer is right in this case :)
« Reply #3 on: September 04, 2018, 05:07:27 pm »
Edit: Where are the rules?
Link to rules http://forums.codeblocks.org/index.php/topic,9996.0.html

**** The link at bottom of post no longer links to the rules!!!!

Tim S.
« Last Edit: September 04, 2018, 05:11:29 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Testing, compiling CB Trunk against wxWidgets 3.0.2.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7262
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: what answer is right in this case :)
« Reply #4 on: September 05, 2018, 08:59:42 pm »
Edit: Where are the rules?
<...>
**** The link at bottom of post no longer links to the rules!!!!

Fixed, thanks for reporting !