How to solve this

#include
using namespace std;

int main(){
long signed CodingBlocks = 2017;
short unsigned BOSS1 = -2018;
unsigned BOSS2 = -2019;
int BOSS3 = -2020;
long long unsigned BOSS4 = -2021;
short unsigned Nagarro = 2018.9;
long signed HackerBlocks = ‘A’;
cout<<CodingBlocks<<endl;
cout<<BOSS1<<endl<<BOSS2<<endl<<BOSS3<<endl<<BOSS4<<endl;
cout<<Nagarro<<endl;
cout<<HackerBlocks<<endl;

return 0;
}"

Hi @divisharoy14_5d0aa86c37c6588a,

​long signed CodingBlocks = 2017;

  1. CodingBlocks = 2017

short unsigned BOSS1 = -2018;

  1. Range of short unsigned is 0 to 65535, as -2018 is out of range.
    So, the final ans is 65535 - 2018 + 1.
    BOSS1 = 63518

unsigned BOSS2 = -2019;

  1. Range of unsigned is 0 to 4294967295, as -2019 is out of range.
    So, the final ans is 4294967295 - 2019 + 1.
    BOSS2 = 4294965277

int BOSS3 = -2020;

  1. Range of int is -32767 to 32767, clearly -2020 is in the range.
    So, BOOS3 = -2020

long long unsigned BOSS4 = -2021;

  1. Range of unsigned long long is 0 to 18446744073709551615, -2021 is out of range.
    So, the final ans is 18446744073709551615 - 2021 + 1
    BOSS4 = 18446744073709549595

short unsigned Nagarro = 2018.9;

  1. Range of short unsigned is 0 to 65535, as 2018.9 is in the range.
    First 2018.9 is typecast to the int
    So, the final ans is2018.
    BOSS1 = 2018

long signed HackerBlocks = ‘A’;

  1. ASCII value of ‘A’ is assigned to HackerBlocks, as ‘A’ ASCII value is 65. So, HackerBlocks = 65

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.