Write a program in java to accept a number form user and print a new number after removing all zeros.
Answers
Answered by
0
Answer:
import java. until. *;
class abc
{
Void main()
{
Scanner sc=new scanner(system. In) ;
System. Out. Print("enter a number") ;
Int n=sc.nextint();
Int s=0;
While(n!=0)
{
If(n%10!=0)
S=s+n%10;
N=n/10;
}
System.out.print("new number=" +s) ;
}
}
Correct all syntax errors
Similar questions
Social Sciences,
5 months ago
English,
5 months ago
Business Studies,
5 months ago
Geography,
10 months ago
Hindi,
10 months ago
English,
1 year ago
Math,
1 year ago