Skip to content

Instantly share code, notes, and snippets.

@Sergaav
Last active August 29, 2015 14:17
Show Gist options
  • Save Sergaav/e563593f9b800cff58dd to your computer and use it in GitHub Desktop.
Save Sergaav/e563593f9b800cff58dd to your computer and use it in GitHub Desktop.
5th digit number to column
package com.gmail.sergaav.dz1_1;
import java.util.Scanner;
public class dz1_1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Введите 5-и значное целое число: \n");
int x;
x = sc.nextInt();
if (x < 100000) {
if (x > 9999) {
int ostatok;
ostatok = x / 10000;
System.out.println(ostatok);
x = x - ostatok * 10000;
ostatok = x / 1000;
System.out.println(ostatok);
x = x - ostatok * 1000;
ostatok = x / 100;
System.out.println(ostatok);
x = x - ostatok * 100;
ostatok = x / 10;
System.out.println(ostatok);
x = x - ostatok * 10;
ostatok = x;
System.out.println(ostatok);
} else
System.out.println("Ошибка ввода числа");
} else
System.out.println("Ошибка ввода числа");
sc.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment