In this program, user will enter any number
and total number of zeros in the number will be displayed.
import
java.io.*;
class Num
{
 int i,num,c=0;
 BufferedReader br=new BufferedReader(new
InputStreamReader(System.in));
 public void take Num () throws Exception
 {
  System.out.println("Enter the
number:");
  num=Integer.parseInt(br.readLine());
  for(i=num;i>0;i=i/10)
  {
   if(i%10==0)
c++;
}
   System.out.print("Total number of zeros
in "+num + " is :"+c);
  }
   public static void main(String args[])throws
Exception
  {
   Num ob=new Num ();
   ob.take Num ();
   }
   }Related Post: BlueJ Programs on Number
No comments:
Post a Comment