A22.0002 - ASSIGNMENT 2


Write a program that reads a 4-digit integer, for instance, 3612. The program should separate the first two digits from the last two, and then add them. Thus in our example the program would assign 36 to a variable, let's say FIRST and then assign 12 to a second variable, let's say SECOND. Finally, it would add the sum of FIRST and SECOND (here, 36 + 12, or 48) and assign it to a third variable, let's say SUM.

The output of your program should show the 4-digit integer read, the integer formed from the first two digits, the integer formed from the last two and then their sum. Hint: Use the MOD and DIV.


Ex:

    Enter a 4-digit number: 3612
    The number entered was: 3612
    The first two digits were: 36
    The last two digits were: 12
    Their sum is: 48