Can someone help me finish this java question. Separating digits 2.30 Separating
ID: 3637304 • Letter: C
Question
Can someone help me finish this java question.Separating digits 2.30
Separating digits:
import java.util.Scanner;
public class Five
{
public static void main(String args[])
{
Scanner input = new Scanner(System.in);
int number; // number input by user
int digit1; // first digit
int digit2; // second digit
int digit3; // third digit
int digit4; // fourth digit
int digit5; // fifth digit
System.out.print("Enter five digit integer: "); // prompt
number = input.nextInt(); // reads number
// determines the five digits
digit1 = number / 10000;
digit5 = number % 10000 % 1000 % 100 % 10;
/* write code here that will separate the reminder of the digits in the variable "number" and assign each one to the corresponding integer variable */
/* write a statement that displays each digit separated by three spaces */
} // end main
} // end class Five
Explanation / Answer
import java.util.Scanner; class Five { public static void main( String [] args ) { Scanner sc = new Scanner( System.in ); System.out.print( "Gimme 5-digit =>: "); String s = sc.nextLine(); for( int i = 0; iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.