Niloy007

Sobuj's Problems solution

Nov 10th, 2019
136
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package Sobuj;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6. public static void main(String[] args) {
  7. Scanner input = new Scanner(System.in);
  8.  
  9. int n = input.nextInt();
  10.  
  11. for(int i=1; i<=n; i++) {
  12. if(i < n) {
  13. if(i%2 == 0) {
  14. System.out.print("0, ");
  15. } else {
  16. System.out.print("1, ");
  17. }
  18. } else if(i == n) {
  19. if(i%2 == 0) {
  20. System.out.print("0");
  21. } else {
  22. System.out.print("1");
  23. }
  24. }
  25. }
  26. }
  27. }
RAW Paste Data