Computer Science, asked by bhavyamishra05, 1 year ago

write a program in java to input any number and remove zero from it in function using buffered reader

no spamming please​

Answers

Answered by amannishad0512p5zxh6
1

import java.io.*;

class Zero

{

public static void main(String args[ ]) throws IO Exception

{

Buffered Reader ob=new Buffered Reader(new InputStreamReader(System.in));

int number,a,t=0; String s="";

number=Integer.parseInt(ob.readLine());

while(number !=0)

{

a=number%10; //to find last digit or moduls

if(a!=0)

s=a+s;. // to concate the digits

number=number/10;. //to reduce number

}

t=Integer.parseInt(s); //to convert string to number

System.out.println("Number after removing zero is "+t);

}

}

Hope It will help you.Compile it if any problem then ask me again.

Mark me brainlest ,for more java doubts follow me.


amannishad0512p5zxh6: Mark me brainlest i m 1st to answer
amannishad0512p5zxh6: In right ways
amannishad0512p5zxh6: And easily
Similar questions