Why does the following program output the second printf statementand not the fir
ID: 3609003 • Letter: W
Question
Why does the following program output the second printf statementand not the first ?Why is (a+b+1) = 1 while (a+1+b) = 0 ?
Will rate lifesaver...thanks!
#include <stdio.h> #include <iostream> #include <math.h>
using namespace std; int main() { float a = 4.68 * pow(2.0,100); /* 4.68 x 2 ^ 100*/ float b = -1 * 4.68 * pow(2.0,100); cout <<a+b+1<<endl; cout<<a+1+b<<endl; if ( (a+b+1) == (a+1+b) ) { printf("Good ! "); } else { printf("Hmmm ? ... "); } return 0; }
Why is (a+b+1) = 1 while (a+1+b) = 0 ?
Will rate lifesaver...thanks!
#include <stdio.h> #include <iostream> #include <math.h>
using namespace std; int main() { float a = 4.68 * pow(2.0,100); /* 4.68 x 2 ^ 100*/ float b = -1 * 4.68 * pow(2.0,100); cout <<a+b+1<<endl; cout<<a+1+b<<endl; if ( (a+b+1) == (a+1+b) ) { printf("Good ! "); } else { printf("Hmmm ? ... "); } return 0; } Why is (a+b+1) = 1 while (a+1+b) = 0 ?
Will rate lifesaver...thanks!
#include <stdio.h> #include <iostream> #include <math.h>
using namespace std; int main() { float a = 4.68 * pow(2.0,100); /* 4.68 x 2 ^ 100*/ float b = -1 * 4.68 * pow(2.0,100); cout <<a+b+1<<endl; cout<<a+1+b<<endl; if ( (a+b+1) == (a+1+b) ) { printf("Good ! "); } else { printf("Hmmm ? ... "); } return 0; }
#include <stdio.h> #include <iostream> #include <math.h>
using namespace std; int main() { float a = 4.68 * pow(2.0,100); /* 4.68 x 2 ^ 100*/ float b = -1 * 4.68 * pow(2.0,100); cout <<a+b+1<<endl; cout<<a+1+b<<endl; if ( (a+b+1) == (a+1+b) ) { printf("Good ! "); } else { printf("Hmmm ? ... "); } return 0; } #include <stdio.h> #include <iostream> #include <math.h>
using namespace std; int main() { float a = 4.68 * pow(2.0,100); /* 4.68 x 2 ^ 100*/ float b = -1 * 4.68 * pow(2.0,100); cout <<a+b+1<<endl; cout<<a+1+b<<endl; if ( (a+b+1) == (a+1+b) ) { printf("Good ! "); } else { printf("Hmmm ? ... "); } return 0; }