Programming contests

Magas szintű programozási nyelvek 1, egyéni verseny, 2016. április 10.

April 10, 2016 10:00 AM – April 10, 2016 3:00 PM

Primary Arithmetic

Children are taught to add multidigit numbers from right-to-left, one digit at a time. Many find the “carry” operation — in which a 1 is carried from one digit position to be added to the next — to be a significant challenge. Your job is to count the number of carry operations for each of a set of addition problems so that educators may assess their difficulty.

Input Specification

Each line of input contains two unsigned integers, each less than 10 digits, separated by a space. The last line of input contains “0 0”.

Output Specification

For each line of input except the last, you should compute and print the number of carry operations that would result from adding the two numbers, in the format shown below.

Sample Input

  1. 123 456
  2. 555 555
  3. 123 594
  4. 0 0
download as text file

Output for Sample Input

  1. No carry operation.
  2. 3 carry operations.
  3. 1 carry operation.
download as text file
University of Debrecen; Faculty of Informatics; v. 03/01/2019