Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can someone help me fix this using Java Eclipse. The question being asked is: Write a program that prompts the user to enter a 5-digit
Can someone help me fix this using Java Eclipse. The question being asked is: Write a program that prompts the user to enter a 5-digit positive integer. Using only the / and % operations, compute each individual digit and display the sum of the digits. Example: Enter a 5-digit positive integer: 30458. The sum of the digits is 3 + 0 + 4 + 5 + 8 = 20
60 7 8 = 1 import java.util.Scanner; 2 3 4 public class Activity2 { 5 public static void main(String[] args) { int Num, Rem, Sum = 0; $C = new Scanner(System.in); 9 System.out.println("Please enter a 5-digit number: "); 10 Num = sc.nextInt(); 11 while(Num>0){ 12 Rem = Num % 10; 13 Sum = Sum + Rem; 14 Num = Num / 10; 15 } 16 System.out.format("Sum of the 5-digit integer %d", Sum); 17 18 19 20 21 } 22 } 23 Problems @ Javadoc Declaration Console X XX bi 9 - - - - o terminated Activity2 [Java Application] C:\Users\jacob\.p2\pool\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.1.v20211116-1657.jre\bin\javaw.exe (Jan 25, 2022, 10:46:29 Exception in thread "main" java.lang. Error: Unresolved compilation problems: SC cannot be resolved to a variable SC cannot be resolved at Activity2.main(Activity2.java:8)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started