Advertisement
Guest User

Untitled

a guest
Nov 19th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. package pl.edu.uwm.wmii.kirkiewiczjakub.kolokwium01;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Zadanie1 {
  6.  
  7. public static void main(String[] args) {
  8. Scanner in=new Scanner (System.in);
  9. System.out.println("Podaj liczbe naturalna: ");
  10. int n = in.nextInt();
  11. double x=in.nextDouble();
  12. double mniejsza=x;
  13. double wieksza=x;
  14. double rowna=x;
  15. for(int i=0;i<n-1;i++)
  16. {
  17. x=in.nextDouble();
  18. if(x>5)
  19. {
  20. mniejsza++;
  21. }
  22. if(x<5)
  23. {
  24. wieksza++;
  25. }
  26. if(x==5)
  27. {
  28. rowna++;
  29. }
  30. }
  31. System.out.println("Wieksze: "+wieksza+"\n mniejsze: "+mniejsza+"\n rowne: "+rowna);
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement