Conversation
Notices
-
import java.util.Scanner; public class main { public static void main(String[] args) { double a, b; int c; int d; Scanner in = new Scanner(System.in); a = Math.random(); b = Math.floor(a*10); c = (int)b; System.out.println("GUESS THE NUMBER!"); d = in.nextInt(); if(d == c) { System.out.println("YOU GOT IT RIGHT!"); } else { System.out.println("YOU WERE WRONG - THE CORRECT ANSWER WAS: " + c); } System.out.println("THANKS FOR PLAYING GREG'S NUMBER GUESSING GAME"); } } does that look optimized enough?
-
@1greg1 You shouldn't need to go through a, b, and c - you can combine those into one statement unless I'm mistaken. int a = Math.floor(Math.random()*10); - It shouldn't make the random an int.
Monday, 13-Jun-11 23:17:55 UTC from web-
@haganbmj ok, that worked...
-
-