Concatenate and Check Perfect Square-Skillrack

 
JAVA Solution

import java.util.*;
public class Hello {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String s1 = s.next(), s2 = s.next();
        String s3 = s1+s2, s4 = s2+s1;
        int x = Integer.parseInt(s3), y = Integer.parseInt(s4);
        double x1 = Math.sqrt(x);
        if((x1 -Math.floor(x1))==0)
        {
            System.out.print("Yes");
            return;
        }
        else
        {
        double x2 = Math.sqrt(y);
        if((x2-Math.floor(x2))==0)
        System.out.print("Yes");
        else
        System.out.print("No");
        }
    }
}



Happy Programming...!!!

Comments

Popular posts from this blog

First Unique Character in a String

Balanced Binary Tree

Majority Element

Sequential Digits