HOW TO CONCATENATE 2 INTEGERS IN JAVA IN A VERY SIMPLE METHOD
OTHER SITES HAD DONE THAT IN VERY DIFFICULT METHOD BUT WE WILL TEACH YOU HOW TO DO IT SIMPLY JUST FOLLOW THE CODE BELOW:
import java.util.*;
public class concatinate
{
void main()
{
int a,b,k=1,i;
long s;
Scanner sc=new Scanner(System.in);
System.out.print("Enter any two number");
a=sc.nextInt();
b=sc.nextInt();
for(i=b;i>0;i=i/10)
{
k=k*10;
}
s=a*k+b;
System.out.print(s);
}
}
Tags:
#important