Tuesday , December 6 2016
Home / Blue J / Java Program to check for a Kaprekar number

Java Program to check for a Kaprekar number

Here is given java program to check for a Kaprekar number.

But before what exactly is a Kaprekar number and why it is called a kaprekar number?

A Kaprekar number is a number whose square can be broken/partitioned in such a manner that the sum of the partitions adds up to bring the number itself.

Example: 992 = 9801 : 98+01 = 99  (hence a kaprekar number)

Why Kaprekar number. Kaprekar number is named after a great Indian Mathematician Kaprekar

DISCLAIMER:  This program is however limited to check until 99999 because int in java is of 4 bytes= (32 bits) i.e. range of -231 to +231 -1 (including 0) which makes: -2147483648 to +2147483647, Now since in this program 99999 2 exceeds the range for int so program is limited to produce kaprekar numbers until 99999.

OUTPUT:

c program for kaprekar number
Kaprekar number(Output-1)
program for kaprekar number
Kaprekar Number(Output-2)

Incoming terms:  Java program for Kaprekar number icse class 10 class 12, Java program to check for a kaprekar number

Also See:   How to use final keyword in Java

Check Also

Program for Matrix Multiplication in JAVA

Matrix Multiplication:– Here is given a Java Program for Matrix Multiplication also call matrix product. In ...

One comment

  1. KAISER SOURIN CHAKRABORTY

    IT WAS HELPFUL but level is quite high

Leave a Reply

Your email address will not be published. Required fields are marked *

Preventing spam * Time limit is exhausted. Please reload the CAPTCHA.