有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java为什么程序在循环时跳过

为什么我的程序跳过while循环

class DigitRepeat
{
  public static void main(String args[])
  {
      int n=133,dig=3,digit,count=0;

      while(n!=0)
      {
         digit=n%10;
         if(dig==digit)
         {
            count=count++;
         }
         n=n/10;
      }

      if(count==0)
          System.out.println("digit not found");
      else
          System.out.println("digit occurs "+count+" times.");
  }
}

共 (0) 个答案