Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class zad {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int u =sc.nextInt();
- int sq;
- int number = 0;
- switch (u) {
- case 1:
- sq = sc.nextInt();
- System.out.println(sq);
- break;
- case 2:
- do {
- sq = sc.nextInt();
- }
- while(sc.hasNext());
- System.out.println(sq);
- break;
- case 3:
- do{
- sq = sc.nextInt();
- if(sc.hasNextInt()){
- number = sc.nextInt();
- }
- }
- while(sc.hasNext());
- int sum = number+sq;
- System.out.println(sum);
- break;
- case 4:
- break;
- case 5:
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement