Advertisement
Alex0830

Untitled

May 27th, 2020
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. class Main {
  4. public static void main(String[] args) {
  5. Scanner sc = new Scanner(System.in);
  6. int a = sc.nextInt();
  7. int d = 0;
  8. int q = 0;
  9. for (int k = 0; k <= a; k++) {
  10. for (int c = 0; c<k && c<a-d; c++) {
  11. // System.out.println(k + " ");
  12. q++;
  13. }
  14. d+=q;
  15. System.out.println(d);
  16. }
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement