7.3.. Napisati program za ispis dana u sedmici, prema slijedeæoj tabeli:
Listing programa:
//07311002
package zad2;
import java.util.Scanner;
public class zad2 {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
System.out.println("Dani u sedmici");
System.out.print("1-7");
int dan = input.nextInt();
switch (dan) {
case 1:
System.out.println("Ponedeljak");
break;
case 2:
System.out.println("Utorak");
break;
case 3:
System.out.println("Srijeda");
break;
case 4:
System.out.println("Cetvrtak");
break;
case 5:
System.out.println("Petak");
break;
case 6:
System.out.println("Subota");
case 7:
System.out.println("Nedjelja");
break;
default:
System.out.println("Sedmica ima sedam dana ");
break;
}
}}
Ispis na ekranu:
Index
|