employer cover photo
employer logo
employer logo

Briskminds Software Solutions

Azienda coinvolta

Domanda di colloquio di Briskminds Software Solutions

1. Armstrong no 2. Pattern problem 3. Array related problems

Risposta di colloquio

Anonimo

5 lug 2024

first understand what is armstrong number n = 153 1*1*1 + 5*5*5 + 3*3*3 do all digits cube and then add them together here we get the same value as 153 so 153 is a armstrong number code in java public static void main(String []args) { int n = 153; // we can use Scanner Class int rem = 0 , arm = 0 , c = n; while(n>0) { rem = n%10; arm = (rem*rem*rem) + arm; n = n/10; } if(arm==c) { System.out.println(c+" is a armstrong number"); } else { System.out.println(c+" is not a armstrong number"); } }