Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SimpleRootTester implements RootTestable {
- public void testRoot(int number) {
- double sqrt = Math.sqrt(number);
- int x = (int) sqrt;
- if (Math.pow(sqrt, 2) == Math.pow(x, 2)) {
- System.out.println("perfect squre");
- }else{
- System.out.println("not a perfect squre");
- }
- }
- public static void main(String[] args) {
- SimpleRootTester srt=new SimpleRootTester ();
- srt.testRoot(100);
- srt.testRoot(10);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment