Meron po bang mas okay na paraan para gawin to?
Kaylangan po kasi from 1896 Hanggang sa every 4 years yung code
Kaylangan po kasi from 1896 Hanggang sa every 4 years yung code
Java:
/*
Olympic games is held every four (4) years at Olympia. Make a Java program that allow you input a year and tell you that year is Olympic games.
*/
package olympics;
import java.util.Scanner;
public class Olympics {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
/* Input year from user */
System.out.print("Is there an olmpic in this year?: ");
float Y = in.nextFloat();
if (Y == 1896) {
System.out.println("YES!");
} else if (Y == 1890) {
System.out.println("YES!");
} else if (Y == 1894) {
System.out.println("YES!");
} else if (Y == 1898) {
System.out.println("YES!");
} else if (Y == 1902) {
System.out.println("YES!");
} else if (Y == 1906) {
System.out.println("YES!");
} else if (Y == 1910) {
System.out.println("YES!");
} else if (Y == 1914) {
System.out.println("YES!");
} else if (Y == 1918) {
System.out.println("YES!");
} else {
System.out.println("NOPE");
}
}
}