Skip to content

Instantly share code, notes, and snippets.

@modos
Created February 18, 2021 22:13
Show Gist options
  • Save modos/4f9086f3d8280d94dcebf4c6deea4b3d to your computer and use it in GitHub Desktop.
Save modos/4f9086f3d8280d94dcebf4c6deea4b3d to your computer and use it in GitHub Desktop.
چاپ برعکس
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.Scanner;
public class Main {
static Scanner sc;
public static void main(String[] args) {
sc = new Scanner(System.in);
int number;
String result = "";
int counter = 0;
while (true) {
number = sc.nextInt();
if(number == 0)
break;
if(counter==0)
result = String.valueOf(number);
else
result = String.valueOf(number) + '\n' + result;
counter++;
}
System.out.println(result);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment