SHARE
TWEET

Untitled

a guest Mar 18th, 2019 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. System.out.println("Zadanie 1");
  2.         Scanner reader1 = new Scanner(System.in);
  3.         System.out.println("Enter a name: ");
  4.         String n1 = reader1.nextLine();
  5.         System.out.println("Enter a surname: ");
  6.         Scanner reader2 = new Scanner(System.in);
  7.         String n2 = reader2.nextLine();
  8.         System.out.println("Witaj" + n1+ " " + n2);
  9.  
  10.  
  11.  
  12.         System.out.println("Zadanie 2");
  13.         System.out.println("Podaj 10 liczb dodatnich :");
  14.         int i=0;
  15.         int maks=0;
  16.         int min=1000000;
  17.         int suma = 0;
  18.         while(i<10){
  19.             Scanner reader3 = new Scanner(System.in);
  20.             int w = reader3.nextInt();
  21.             maks = max(w,maks);
  22.             min= min(w,min);
  23.             suma+=w;
  24.  
  25.  
  26.             i++;
  27.         }
  28.         float srednia = suma/10;
  29.         System.out.println("Suma: "+ suma);
  30.         System.out.println("┼Ťrednia: "+ srednia);
  31.         System.out.println("Maksimum: "+ maks);
  32.         System.out.println("Minimum: "+  min);
  33.  
  34.  
  35.  
  36.         System.out.println("Zadanie 3");
  37.         System.out.println("Podaj liczb─Ö:");
  38.         Scanner reader4 = new Scanner(System.in);
  39.         float w1 = reader4.nextFloat();
  40.         System.out.println("Podaj znak dzia┼éania:");
  41.         Scanner reader5 = new Scanner(System.in);
  42.         char w2 =  reader5.next().charAt(0);
  43.         System.out.println("Podaj liczb─Ö:");
  44.         Scanner reader6 = new Scanner(System.in);
  45.         float w3 = reader6.nextFloat();
  46.         switch (w2){
  47.             case '+':
  48.                 float suma = w1+w3;
  49.                 System.out.println(w1+ "\n"+ w2 + "\n"+ w3 + "\n"+ suma);
  50.                 break;
  51.             case '-':
  52.                 float roznica = w1-w3;
  53.                 System.out.println(w1+ "\n"+ w2 + "\n"+ w3 + "\n"+ roznica);
  54.                 break;
  55.             case '*':
  56.                 float iloczyn = w1*w3;
  57.                 System.out.println(w1+ "\n"+ w2 + "\n"+ w3 + "\n"+ iloczyn);
  58.                 break;
  59.             case '/':
  60.                 float iloraz = w1/w3;
  61.                 System.out.println(w1+ "\n"+ w2 + "\n"+ w3 + "\n"+ iloraz);
  62.                 break;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top