Created
May 10, 2017 13:03
-
-
Save baesparza/1ceab670011771c1ecdb4905ce2b6aac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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