answersLogoWhite

0


Best Answer

import java.io.*;

class kaprekar

{

public static void main(String args[])throws IOException

{

BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

System.out.println("Enter any number");

int n=Integer.parseInt(br.readLine());

int t=n,count=0;

while(n!=0)

{

n=n/10;

count++;

}

int s=t*t;

int p=(int)Math.pow(10,count);

int ld=s%p;

int minus=s-ld;

int fd=minus/p;

int sum=fd+ld;

if(sum==t)

{

System.out.println("Kaprekar Number");

}

else

{

System.out.println("Not a Kaprekar number");

}

}

}

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you code a program to find kaprekar number?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Program to find the greatest number?

The greatest number is infinity.


How do you dump any program code on micro controller 89c51?

In order to dump any program code onto a micro controller for a 89c51, you would first have to find access to the main controller board of the item, and plug the program code directly into that.


Can you get a Java program to find the cube of a number?

Yes


What is the code of C language program- input today date find tomorrow date?

#include


Menu driven program in c programming?

You can find the source code of the menu driven graphics program here: http://www.start2code.com/Cresources/menu-driven-graphics-program-c.html

Related questions

Write a C program called MonthDays to find the number of days in a given month Test your code with different input values to demonstrate that your function is robust?

Write a C program called MonthDays to find the number of days in a given month Test your code with different input values to demonstrate that your function is robust?


Program to find the greatest number?

The greatest number is infinity.


What is the coral 12 activation code?

I am needing to find the code to use a coral paintshop pro program


How do you dump any program code on micro controller 89c51?

In order to dump any program code onto a micro controller for a 89c51, you would first have to find access to the main controller board of the item, and plug the program code directly into that.


Java source code to find prime number?

/* Program to Find whether number is Prime or Not. */ class PrimeNo{ public static void main(String args[]){ int num = Integer.parseInt(br.readLine()); int flag=0; for(int i=2;i


Can you get a Java program to find the cube of a number?

Yes


How do you find bugs in a computer program?

Typically, you run the program through "debuggers" - software that specifically looks for errors in your code.


Write a shell program to find given no is even or odd?

The pseudo code would be as follows (you figure out the syntax) 1) Prompt the user to enter a number 2) If entered number is alpha, quit program after displaying message that the user ended the program. 3) Otherwise, find Modulo 2 of the entered number. This is a fancy way of saying "find the remainder when the number is divided by 2) 4) If Modulo 2 is zero, the number is even, otherwise odd 5) Display message showing if the entered number was Even or Odd 6) Branch back to step 1


How do you find a phone number zip code?

The easiest way to search for a phone number are ode or a zip code for a phone number is to search the phone number area code on google for the zip code.


Find ifsc code using account number?

To find the IFSC code, you will not be able to use the account number but will need the name of the bank and location.


Where do you find Epiphone product code number?

The code seems to be in the box of the guitar, the big number above the barcode.


Where do you go on Disney to type in the number of times they say Princess in the Princess Protection Program?

You must go to DisneyChannel.com/Princess Protection Program. Then click crack the code. I've looked and there is no crack the code buttons left. Hopefully you've already did this. Just in case you find one, well improve this answer. And type in 086. Hopefully you find one . P.S Good Luck Thanks