Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

disarium number in java

import java.util.*;
import java.lang.*;
class disarium
{
    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
        System.out.println("Enter Number: ");
        int num = sc.nextInt();        
        String s = Integer.toString(num);
        int l = s.length();        
        int n = num;       
        double c = 0;        
        int last_digit;
        
        while(num > 0)
        {
            last_digit = num % 10;
            
            c = c + Math.pow(last_digit,l);
            
            num = num / 10;
            
            l--;
        }
        if(n == c)
        {
            System.out.println("Disarium Number.");
        }
        else
        {
            System.out.println("Not a Disarium Number.");
        }
        sc.close();
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: i java 
Java :: java producer consumer queue 
Java :: java.lang.noclassdeffounderror: failed resolution of: lorg/apache/http/protocolversion; 
Java :: java codigo para criar um aleatorio entre valores 
Java :: java no name array eg 
Java :: Pre Render View 
Java :: Use following code to open activity while your application is not running. 
Java :: java for loop example 
Java :: spigot wolf death message 
Java :: how to set id to TextView programmatically java android 
Java :: java int data type 
Java :: detect jpanel size change listener 
Java :: coustimized divider in android 
Java :: edit xmlns attribute with jaxb marshaller 
Java :: broswerCallback springboot and jms 
Java :: zufallszahl java 
Java :: exception handling and reprompting 
Java :: Obtaining all data in a table with Hibernate 
Java :: sorting boolean array with prime index 
Java :: ex: Overflow in java 
Java :: hdfs get size of directory java 
Java :: java param.ExStyle |= 0x08000000; 
Java :: spring environment null pointer exception 
Java :: fix intellij resetting the java version everytime you add a dependency 
Java :: online money transfer andhra bank 
Java :: what is this code (long millis=System.currentTimeMillis(); java.sql.Date date=new java.sql.Date(millis); 
Java :: spring data rest relationships 
Java :: forge close gui java 
Java :: clear array in java 
Java :: how to uncomment a block of statements in java 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =