Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Rdf
- {
- public static void main(String[] args)
- {
- int number1;
- number1 = getNumb();
- sumOfNumbers(number1);
- }
- public static int getNumb()
- {
- int input;
- System.out.println("Prosze wprowadzic liczbe");
- Scanner scanner = new Scanner(System.in);
- input = scanner.nextInt();
- if (input <1)
- {
- System.out.println("Wprowadzona liczba jest nie poprawna, proszę jeszcze raz wpisac liczbe");
- getNumb();
- }
- return input;
- }
- public static void sumOfNumbers(int input)
- {
- for(int i =1; i<input; i++)
- {
- System.out.print(i + " ");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement