Skip to main content

Posts

Showing posts with the label armstrong number

ARMSTRONG NUMBER

PROGRAM : ARMSTRONG NUMBER Armstrong Number in Java .  Armstrong Number in Java :  Armstrong number  is a number  that is equal to the sum of cubes of its digits for example 0, 1, 153, 370, 371, 407 etc. SYNTAX : import java.io.*; class armstrong  {     public static void main(String args[])throws IOException     {         BufferedReader br=new BufferedReader(new InputStreamReader(System.in));         int n;int n1;         System.out.println("Enter a Number");         n=Integer.parseInt(br.readLine());         n1=n;int d=0,sum=0;         while(n!=0)         {             d=n%10;             sum+=Math.pow(d,3);             n=n/10;         }         if(su...