I simply want to calculate this: "1039 * 3749 * 8473" in C++. I have tried long,long long, unsigned long long, nothing helps.
'''
int main(){
unsigned long long int a;
a = 1039 * 3749 * 8473;
cout<< a<<endl;
return 0;
'''
I get the following message(warning): test.cpp:8:21: warning: integer overflow in expression of type 'int' results in '-1355615565' [-Woverflow] 8 | a = 1039 * 3749 * 8473; | ~~~~~~~~~~~~^~~~~~ 18446744072353936051 Please help me resolve this, a test case is pending upon this.
llfor long long, changing its type. All subexpressions (which are the 3 literals) currently have type int, which makes the whole expression to the right of the assignment operator having type int, which cannot hold the result.1039 * 3749 * 8473areints, the result isint.