| Input file: | longdiv.in |
| Output file: | longdiv.out |
Data in the input line comes in pairs, with the first line containing the dividend and the second line containing the divisor. Your program is to accept only correct dividends and divisors. Thus, if either the divident or its divisor contains any non-digit, i.e., a character not in [0..9], or the divisor is greater than 99 you are to print an error message, as shown below in the example data, between the dividend/divisor pairs.
If you read in two valid values, you are to compute the quotient and remainder and output the results as shown on the sample output shown below. You are to use normal end-of-file methods to terminate your reads from the input data file. Always skip a line, as shown below in the example data, between the dividend/divisor pairs.
3845098340950934858345080594385091259814 97 9 3 815777777A 51 432567 125
Dividend is 3845098340950934858345080594385091259814 Divisor is 97 Quotient is 39640189081968400601495676230774136699 Remainder is 11 Dividend is 9 Divisor is 3 Quotient is 3 Remainder is 0 Dividend is 815777777A Divisor is 51 Illegal Dividend 815777777A Dividend is 432567 Divisor is 125 Illegal Divisor 125