fork download
  1. import java.util.*;
  2. public class Main {
  3. public static void main(String args[]) {
  4. Scanner scn=new Scanner(System.in);
  5. int N=scn.nextInt();
  6. int height,hypo;
  7. if(N%2==0)
  8. {
  9. int m=N/2;
  10. int n=1;
  11. height=(m*m)-(n*n);
  12. hypo=(m*m)+(n*n);
  13. }
  14. else if(N%2!=0)
  15. {
  16. int m=(N+1)/2;
  17. int n=(N-1)/2;
  18. height=2*m*n;
  19. hypo=((m*m)+(n*n));
  20. }
  21. else System.out.print("-1");
  22. System.out.print(height+" ");
  23. System.out.print(hypo);
  24. }
  25. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:22: error: variable height might not have been initialized
		System.out.print(height+" ");
		                 ^
Main.java:23: error: variable hypo might not have been initialized
		System.out.print(hypo);
		                 ^
2 errors
stdout
Standard output is empty