Advertisement
Md_Sakib_Hossain

Pattern

Feb 26th, 2021
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.57 KB | None | 0 0
  1. import java.util.*;
  2. public class FPP{
  3.     public static void main(String[] args) {
  4.         Scanner scan = new Scanner(System.in);
  5.         int n = scan.nextInt();
  6.         String str1="",str2="";
  7.         int count=0;
  8.         for (int i=0;i<=n;i++) {
  9.             if(count==0)
  10.             {
  11.                 str1=str1+(i+1);
  12.             }else if (count==1 || count==2) {
  13.                 str2=str2+(i+1);
  14.             }else{
  15.                 str1=str1+(i+1);
  16.                 if (count==4) {
  17.                     count=0;
  18.                 }
  19.             }
  20.             count++;
  21.  
  22.         }
  23.         int num1,num2;
  24.         num1 = Integer.parseInt(str1);
  25.         num2 = Integer.parseInt(str2);
  26.         System.out.println(num1);
  27.         System.out.println(num2);
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement