Jump to content
Dante Unbound: Share Bug Reports and Feedback Here! ×

Programming Class


Kiwi
 Share

Recommended Posts

In my programming class we are learning Java, and we had a speed code challenege. I was first <3

We had to create a program that had an array of 10 integers and you then had to make it generate 10 random numbers between 1 - 10 and add them to the array.. Here is my code ;)

//Coded by Kiwi

//creates a random number and adds it to the array

public class randomArray {

public static void main(String[] args) {

int[] randArray = new int[10];

for(int i = 0; i < randArray.length; i++) {

int tempNum = (int)(Math.random() * 10 + 1);

randArray = tempNum;

System.out.println(randArray);

}

}

}

Link to comment
Share on other sites

/tears in eyes, I remember when i use to code html

<3 you better be proud of me !

My brain is fried by your intelligence!

Awww shucks :3

also, my code is 10 lines.. Everyone elses was over 15-20 :') I'm a hero

Link to comment
Share on other sites

  • 1 year later...
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...