From 70b8832c1abb695a4180a55b68833033452aa7bf Mon Sep 17 00:00:00 2001 From: Jyoti Kumari <71651949+me-jyotii@users.noreply.github.com> Date: Mon, 12 Oct 2020 22:04:25 +0530 Subject: [PATCH] Create checkingNumber Check weather the difference of square of two numbers is a square or not... --- checkingNumber | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 checkingNumber diff --git a/checkingNumber b/checkingNumber new file mode 100644 index 0000000..a1e2e70 --- /dev/null +++ b/checkingNumber @@ -0,0 +1,29 @@ +package practice; + +import java.util.Scanner; + +public class CheckNumDifferenceSquare { + + public static void main(String[] args) { + + Scanner scan = new Scanner (System.in); + System.out.print("enter num to check "); + int num = scan.nextInt(); + checkNum(num); + } + public static void checkNum(int num) + { + for(int fnum=1; fnum<=num; fnum++) + for(int snum=1; snum<=fnum; fnum++) + { + if(fnum*fnum - snum*snum == num) + { + System.out.println("yes"); + break; + } + } + + } + + +}