Advertisement
KeeganT

Ch4Ex7 v1

Feb 6th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.53 KB | None | 0 0
  1. package ch4ex7;
  2. import java.util.Scanner;
  3.  
  4. public class Ch4Ex7
  5. {
  6.     public static void main(String[] args)
  7.     {
  8.         Scanner sc=new Scanner(System.in);
  9.         int num;
  10.         System.out.print("Enter a three-digit number: ");
  11.         num=sc.nextInt();
  12.         System.out.println("The hundreds-place digit is: "+num/100);
  13.         System.out.println("The tens-place digit is: "+(num-((num/100)*100))/10);
  14.         System.out.println("The ones-place digit is: "+(((num-(num/100)*100))-((num-(num/100)*100)/10*10)));
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement