samedi 4 juin 2016

write a java program which generates a random number such that 0 <= random number <= n-1 where n is a given input number

I understood the logic but couldn't understood how to code it in JAVA,

Scanner input = new Scanner(System.in);

System.out.println("Enter a number");

int n= input.nextInt();
int randomInteger = random.nextInt();

for(n=0; n<=randomInteger;n-1){      
    System.out.println();
}




Aucun commentaire:

Enregistrer un commentaire