Write a program in Java ya read a number, remove all zeros from it, and display the new number. For example,
Sample input: 45407703
Sample output:. 454773
Answers
Answered by
0
Answer:
import java.util.Scanner;
public class Nums
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
int num = in.nextInt();
int last = 0;
for (int n=num ; n!=0 ; n=n/10) {
if (n%10 != 0) {
System.out.print(n);
}
}
}
}
Similar questions