Make a program where you enter a 3-digit integer. The program will then print out what the century, the tens and the singles are.
A) Solve the problem with integer division (% and /).
B) Solve the task with strings.
This is my homework, I solved the A but need support with B, I displayed A code but it similar to B?
import java.util.Scanner;
public class UppgiftAttaA {
public static void main(String[] args) {
int tal = 0;
int taltio = 0;
int talen = 0;
int talhund = 0;
System.out.println("Skriv ett tal som är större än 100");
Scanner read = new Scanner(System.in);
tal = read.nextInt();
talen = (tal / 1) % 10;
System.out.println("en tal är " + talen * 1);
taltio = (tal / 10) % 10;
System.out.println("tio tal är " + taltio * 10);
talhund = (tal / 100) % 10;
System.out.println("hundra tal är " + talhund * 100);
}
}