Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- import java.util.Scanner;
- class Joc {
- public static void main(String args[]){
- int val1=0,val2=0;
- System.out.println("Numele jucatorului \t Numarul dat");
- Scanner tura1 = new Scanner(System.in);
- String first = tura1.next();
- Random dice = new Random();
- val1 = dice.nextInt(100);
- System.out.println(tura1.nextLine() + " " + val1);
- System.out.println("Numele jucatorului \t Numarul dat");
- Scanner tura2 = new Scanner(System.in);
- String seconde = tura2.next();
- val2 = dice.nextInt(100);
- System.out.println(tura2.nextLine() + " " + val2);
- if (val1 > val2){
- System.out.println("Castigatorul este " + first);
- }else if(val1 == val2){
- System.out.println("Este egalitate");
- }else{
- System.out.println("Castigatorul este " + seconde);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement