Question: In mathematics, a Kaprekar number for a given base is a non-negative integer, the representation of whose square in that base can be split into

In mathematics, a Kaprekar number for a given base is a non-negative integer, the representation of whose square in that base can be split into two parts that add up to the original number again. The Kaprekar numbers are named after D. R. Kaprekar.

Take a positive whole number n that has d number of digits. Take the square of n and separate the result into two pieces: a right-hand piece that has d digits and a left-hand piece that has either d or d-1 digits. Add these two pieces together. If the result is n, then n is a Kaperekar number. Examples are 9 (92 = 81, 8 + 1 = 9), 45 (452= 2025, 20 + 25 = 45), and 297 (2972= 88209, 88 + 209 = 297).

Display all the Kaprekar numbers less than 10000 (using a loop).

Do not use arrays or files.

This includes proper indents, capitalization, use of correct structure keywords, no C++ coding (do it in English!) and no extra blank lines. No functions or arrays will be permitted in the program.

-------------------------------so far

problem: a program to test kaprekar numbers less that 10,000

Inputs: none

Outputs: kaprekar numbers

Formulas: squared number = number * number, first half = squared number/unit, second half = remainder of squared number/unit, first half + second half

START

-

-

-

STOP

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!