Find the nth number in the increasing sequence formed by 0,2,4,6,8?

前端 未结 2 1231
青春惊慌失措
青春惊慌失措 2021-01-05 01:57

We have an increasing sequence in which each element is consist of even digits only (0, 2, 4, 6, 8). How can we find the nth number in this sequence

Is

2条回答
  •  长发绾君心
    2021-01-05 02:32

    int Code()
    {
        k=0;
       for(i=0;i<=10000;i++)
       {
           count=0;
           n=i;
           while(n!=0)
           {
               c=n%10;
               n=n/10;
               if(c%2!=0)
               {
                   count=1;
               }
           }
           if(count==0)
           { a[k]=i;
           k++;}
        }
     }
    

提交回复
热议问题