Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- import java.util.Scanner;
- class main{
- public static void main(String args[]){
- Scanner deer = new Scanner(System.in);
- Random gmn = new Random();
- double numb;
- double jagnumb;
- System.out.println("I am thinking of a number between 1 and 10. Can you guess it?");
- jagnumb = deer.nextDouble();
- for(double counter=1;counter<=1;counter++){
- numb = 1+gmn.nextInt(10);
- if(jagnumb == numb){
- System.out.println("You guessed the number!");
- }else{
- System.out.println("Sorry, you were wrong! The number was " + numb + ".");
- } }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement