Tag

coding interview questions part 1

Browsing

Armstrong Number An Armstrong Number is a number that is the sum of its own digits each raised to the power of the number of digitsArmstrong numbers are those numbers in which sum of cube of all digits provides the same number.Example:-1531^3 = 15^3 = 1253^3 = 271^3 + 5^3 + 3^3= 1 + 125 + 27= 153 Source Code package com.dsacode.Probelms; public class ArmstrongNumer { public static boolean isArmStrong(int num) { int result = 0; int orig = num; while(num != 0){ int remainder = num%10; result = result + remainder*remainder*remainder; num = num/10; } if(orig == result){ return…