Skip to content

Instantly share code, notes, and snippets.

@baesparza
Created May 10, 2017 13:03
Show Gist options
  • Save baesparza/1ceab670011771c1ecdb4905ce2b6aac to your computer and use it in GitHub Desktop.
Save baesparza/1ceab670011771c1ecdb4905ce2b6aac to your computer and use it in GitHub Desktop.
package contadordecreciente;
import java.util.Scanner;
/**
*
* @author baesparza
*/
public class ContadorDecreciente {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner input = new Scanner(System.in);
// Variables
int max, n, x = 0;
double num;
//Entrada de datos
System.out.print("Ingrese un numero: ");
n = input.nextInt();
//Procesos
num = (Math.ceil(n / 10)) * 10; //Lo transformamos a decimal y lo redondeamos
max = (int) (num + 10); //Le sumamos
do{
System.out.println(max);
max -= 10;
} while (max > 0);
System.out.println(max);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment