ICSE 2019 TECH NUMBER

A tech number has even number of digits. If the number is split in two equal halves, then the square of sum of these halves is equal to the number itself. Write a program to generate and print all four digits tech numbers.
Example -
Input = 3025
(30+25)^2
=55^2
=3025
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Demo
{
public static void main (String[] args) throws java.lang.Exception
{

int fs=0,ls=0,t=0,num=0;
for(int i=1000;i<=9999;i++)
{
fs=i%100;
ls=i/100;
t=fs+ls;
num=(int)Math.pow(t,2);
if(num==i)
System.out.println("Tech Number"+i);

}

}
}

Output=
2025
3025
9801

https://amzn.to/2HtcH2h

Tech Number

A tech number has even number of digits. If the number is split in two equal halves, then the square of sum of these halves is equal to the number itself. Write a program to check tech numbers.
Example -
Input = 3025
(30+25)^2
=55^2
=3025

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Demo
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter a number");
int n=sc.nextInt();
int k=n,c=0,f=0,fs=0,ls=0,t=0,num=0;
while(k>0)
{
c=c+1;
k=k/10;
}
if(c%2==0)
{
c=c/2;
f=(int)Math.pow(10,c);
fs=n%f;
ls=n/f;
t=fs+ls;
num=(int)Math.pow(t,2);
if(num==n)
System.out.println("Tech Number");
else
System.out.println("Not a Tech Number");
}
else
{
System.out.println("Not a Tech Number");
}
}
}

Second largest number in java using ternary operator

 //Largest second number using ternary operator public class Main { public static void main(String[] args) { int a=5,b=6,c=7; int ...