Diary of an IT Guy #AnakBinus

Build Bridges, not Walls. Collaboration Forever!

Java Practice: Nested Loop

leave a comment »

import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner read = new Scanner(System.in);
boolean isSuspended = read.nextBoolean();
int ourScore = read.nextInt();
int theirScore = read.nextInt();

// your code goes here
if (!isSuspended ){
if (ourScore > theirScore ){
System.out.println("Won");
}

if (ourScore < theirScore ){
System.out.println("Lost");
}

if (ourScore == theirScore ){
System.out.println ("Draw");
}

} else{
System.out.println("Suspended");
}

}
}

Written by isal

6 Mei 2021 pada 21:47

Ditulis dalam Uncategorized

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout /  Ubah )

Foto Google

You are commenting using your Google account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d blogger menyukai ini: