diff --git a/README.md b/README.md index e694b5b..1b3bd19 100644 --- a/README.md +++ b/README.md @@ -1 +1,45 @@ -# Java_Lessons \ No newline at end of file +# Java_Lessons +/* +Написать программу которая считывает 5-и значное число с +клавиатуры и выводит цифры из которого оно состоит. +*/ + + +package com.gmail.orfejka; + +import java.util.Scanner; + +public class Main { + + public static void main(String[] args) { + + Scanner sc = new Scanner (System.in); + System.out.println("Enter a five-digit number: "); + while(sc.hasNext()) + { + if(sc.hasNextInt()) + { + int number =sc.nextInt(); + int j =10000; + + for(int i=0; i<5; i++) + { + int k =number/j; + System.out.println(k); + number%=j; + j/=10; + } + + } + else + { + System.out.println("Wrong number.Enter a five-digit number:"); + sc.next(); + } + sc.close(); + } + + } + + +}