V22.0002
Summer 2001

ASSIGNMENT 1

Due: Tuesday, May 22nd


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 % and / operators and Integer Numbers.

 

When you are done and have tested it, email your source file to the E-Tutor at v002su1@cs.nyu.edu