Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ch4ex7;
- import java.util.Scanner;
- public class Ch4Ex7
- {
- public static void main(String[] args)
- {
- Scanner sc=new Scanner(System.in);
- int num;
- System.out.print("Enter a three-digit number: ");
- num=sc.nextInt();
- System.out.println("The hundreds-place digit is: "+num/100);
- System.out.println("The tens-place digit is: "+(num-((num/100)*100))/10);
- System.out.println("The ones-place digit is: "+(((num-(num/100)*100))-((num-(num/100)*100)/10*10)));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement