print all the zeros at last

WAP to print all the zeros at last of input integer.

import java.util.*;

class E5PrintZeroAtLast

{

    public static void main()

    {

        int x,l;

        int a=0,d=0,z=0;

        System.out.println("Enter any inter \n\n");

        Scanner in=new Scanner(System.in);

        x=in.nextInt();


        while(x>0)

        {

            l=x%10;

            if(l!=0)

            {

                a=(int)(Math.pow(10,z))*l + a;

                z++;

            }

            else

                d++;

            x=x/10;

        }

        System.out.println("Required number= "+a*(int)Math.pow(10,d));

    }

}



For Any Desired Program comment below. WE WILL TRY OUR BEST TO MAKE THAT PROGRAM AVAILABLE.

Comments

  1. Print the series using for loop.
    0.1, 0.11, 0.111, 0.1111

    ReplyDelete
    Replies
    1. hey, your program is posted. Click on https://intuition4science.blogspot.com/2020/07/series-01-011-0-111.html for more program comment below or whatsapp on 7004646949
      thanks and share this your group...

      Delete

Post a Comment

Popular Posts