Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training  

Magic number in java



Share on Google+Share on Google+

R Radhika
Magic number in java
1 Answer(s)      6 years and a month ago
Posted in : Java Beginners

Hi.. Can any one tel how to watch a magic number of a program?

View Answers

June 27, 2011 at 12:41 PM

import java.util.*;

 class MagicNumber{

    public int divide(int x){
    int a,b=0;
    for(int i=x;i>0;i/=10){
    return b;

   public static void main(String[]args)throws Exception{
        Scanner input=new Scanner(;
        System.out.print("Enter the number: ");
        int num =input.nextInt();
        int b=0,x=1;
        MagicNumber l=new MagicNumber();
            b=l.divide(num); x++;
          System.out.print("Magic Number");
          System.out.print("Not a Magic Number");


Related Tutorials/Questions & Answers:
Magic number in java
Magic number in java  Hi.. Can any one tel how to watch a magic...==1) System.out.print("Magic Number"); else System.out.print("Not a Magic Number
Magic number Java Program
Magic number Java Program  write a program that guesses what number the user is thinking of. Below is a sample transcript: Think of a number between 1 and 255. I will guess the number you are thinking of. 1 3 5 7 9 11 13 15 17
Magic Squares - Java Beginners
Magic Squares  Magic Squares A magic square is an n by n grid... on this definition, an example magic square for n = 4 is 16 15 1 2 6 4 10 14 9 8 12 5 3... than n2). boolean checkmagic() Returns true if the matrix is a magic square
Robust Magic Square Tester - Java Beginners
Robust Magic Square Tester  I need a program to determine if a file of numbers is a magic-square. a magic square of order n is an arrangement of n... diagonals sum to the same constant. A normal magic square contains the integers
Magic Matrix in GUI
Magic Matrix in GUI  I want program in java GUI contain magic matrix for numbers
How to format number in Java?
How to format number in Java?  Hi, What is the best way to format a number in Java? How to format number in Java? Thanks   Hi, To format number in Java you can use the class java.text.NumberFormat. Here is simple
getting random number in java
getting random number in java  getting random number in java Hi... and scaling the random number in my Java Random number eample. but for some reason... to generate the random number in Java Thanks in Advance
number of stairs - Java Beginners
number of stairs  1. Write a program that prints an n-level stair case made of text. The user should choose the text character and the number...(); } } } ----------------------------------- read for more information,
prime number - Java Beginners
prime number  i want to write a code in java that picks prime numbers... boolean isPrime(int number){ boolean isPrime=false; int i=(int) Math.ceil(Math.sqrt(number)); while (i>1
number - Java Interview Questions
number  apka number kya hai aap apna number mera id per send ker do
prime number - Java Beginners
prime number  this project is to determine if a phone number is a prime number. if the number is a prime number then print a message to the effect. if the number is not a prime number then print the prime factors of the number
add number - Java Beginners
add number  Q. write a programe to add three number. The number input... input=new Scanner(; System.out.println("Enter first number"); int a=input.nextInt(); System.out.println("Enter second number"); int b
Number Convert - Java Beginners
passString(int number){ int num, q ; if (number < 10 ){ displayOutput(a[number...]) ; } if ( number > 19 ){ num = number % 10 ; if ( num == 0 ){ q = number / 10 ; displayOutput (d[q-2]) ; } else{ q = number / 10 ; displayOutput(a[num
perfect number - Java Beginners
perfect number  An integer number is said to be a perfect number.... For example, 6 is a perfect number because 6 = 1+2+3. Write a method perfect that determines if parameter number is a perfect number. Use this method
program on factorial of a given number in java
program on factorial of a given number in java  please tell me, how to write program on factorial of a given number in java
program on factorial of a given number in java
program on factorial of a given number in java  please tell me, how to write program on factorial of a given number in java
GUESS NUMBER - Java Beginners
GUESS NUMBER  Create a guessing game that picks a random number...() { super("Guess Number"); randomNumber = new Random().nextInt(100) + 1...); panelBottom.add(comment, BorderLayout.SOUTH); panel.add(new JLabel(" Guess a number from
PHP Magic Constant
PHP Magic Constants: In PHP there are various predefined constants, but many... of the magic constants are as follows: 1) __LINE__: This constant is used to indicate the current line number of the file. 2) __DIR__ :  This constant is used
Convert Number to Roman Number Using Java
Java Convert Number to Roman Numerals In this section, you will learn how to convert the number to roman number.  To do this, we have created a class... and the method convertIntegerToRoman(int n) convert the specified number into roman
Java reverse number
Java reverse number In this tutorial, you will learn how to reverse a number in java. In java, you can use arithmetic operators like division operator(/) and remainder operator(%) to reverse the number. The division operator returns
java code for swaping two number
java code for swaping two number  how to code for swaping two number without taking third variables
java number to word - Java Beginners
java number to word  Can somebody please fix this to come out with the word, not the number 23? import java.util.Scanner; public class... " + "position followed by 5 integers \nspecifying the number
PHP Magic Methods
Magic Methods in PHP: In PHP there are so many methods are included in recent versions, magic methods are one of them. The magic methods are listed below..._state() __clone() In the above list of the magic methods it is very
Prime Number program in Java
Prime Number program in Java will print the prime numbers between 1 to any given number. Prime Number is a number that is not divisible by any number other... automatically prints Prime Number starting from 1 to 50. Example of Prime Number
How to format number in Java?
Learn about the code of formatting the number in Java This tutorial explains you how to format the number in Java. There are number of situations where we need the number to be formatted in many different formats. Depending the format
javascript max number - Java Beginners
javascript max number  hi all, i m trying to find maximum number...: var number,i,max; for(i=1;i<11;i++) { number=prompt("Enter a number"); if(i==1) max=number; document.write("Number
Java get number of Processors
Java get number of Processors   ... of processors available in Java Virtual Machine. To display the number...("Number of processors available to the Java Virtual Machine
guess number - Java Interview Questions
guess number  i am doing a java program for user to guess number. i...) { input=JOptionPane.showInputDialog("Invalid number!Please re-enter... .."); private int randomNumber; public guess2() { super("Guess Number
Prime Number in Java
Prime Number in Java       This Java programming tutorial will be read how to get prime number. First of all we will define a class "Prime Number". Java I/O package
list file number - Java Beginners
list file number  sir you still haven't understand my problem. i have to list out only the number of files in a given directory,your solution still give number of (files+directories) in given directory. are jfilechooser provide
how to create month wise serial number in java?
how to create month wise serial number in java?  Ex: For 1)January-serial number is 1/001,1/002,1/003 etc