I know that the max value for short data type is 32767 and d=2a=2(20000)=40000 that is greater than 32767
therefore the result of d is in minus d= -25536 while a,b and c displayed as they are scince they are< 32767 ,but the question is from where we get this number -25536 ?
#include <iostream>
using namespace std;
int main()
{
short a, b, c, d;
a=20000;
b=10000;
c=a+b;
d=2*a;
cout<<a<<endl;
cout<<b<<endl;
cout<<c<<endl;
cout<<d<<endl;
system("pause");
return 0;
}