Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Sumator {
- public static void main(String[] args) {
- System.out
- .println("Wprowadź liczby, na końcu daj zero by zakończyć, program zsumuje liczby");
- Scanner load = new Scanner(System.in);
- float sum = 0;
- for (int i = 0; i < Integer.MAX_VALUE; i++) {
- float numbers = load.nextFloat();
- if (numbers == 0)
- break;
- sum += numbers;
- }
- System.out.println("Suma wprowadzonych przez Ciebie liczb to: " + sum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment