So Im trying to make a function that returns an arbitrary integer integer which is greater than X, not greater than 1,000,000,000 , and that ends with 0. You can assume that X is between 1 and 999,999,999. For example, given X = 33, your funcitonm may return 77 and for X = 22, your function may return 92.
Here is what I got so far, not sure if im even doing it right...
import java.util*;
import java.io*;
public class exerciseA {
public static void main(String[] args) throws Exception {
int max = 1000000000;
int min = 0;
int diff = max - min;
Random arbitrary = new Random();
int i = arbitrary.nextInt(diff + 1);
i += min;
System.out.print("The arbitrary Number is " + i);
}
}
Aucun commentaire:
Enregistrer un commentaire