Question: c) Is there any compiler or logic error? If so, explain them in detail. d) What is the goal of the following code, write it
c) Is there any compiler or logic error? If so, explain them in detail. d) What is the goal of the following code, write it in a sentence. No more than 1 sentence! import java.util.Scanner; public class 26{ public static void main(String[]args) { Scanner s = new Scanner (System.in); System.out.println("Enter the number"); int number=s.nextInt(); int result=armstrong (number); if (result==number) System.out.println(number+" is an Armstrong number"); } else System.out.println(number+" is not an Armstrong number"); } public static int armstrong (int number) { int x=0; int sum=0; while (number>0){ int a=number$10; number=number/10; x=a*a*a; sum+=x; } return sum; 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
