HOW TO CONCATENATE 2 INTEGERS IN JAVA IN A VERY SIMPLE METHOD

 

HOW TO CONCATENATE 2 INTEGERS IN JAVA IN A VERY SIMPLE METHOD
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);
    }
}

Post a Comment

Please Select Embedded Mode To Show The Comment System.*

Previous Post Next Post

It looks like you're using an ad blocker. We rely on ads to keep our site free, please whitelist us!

Click here to continue

Please whitelist our site to continue enjoying our content.

Whitelist | Close