You are viewing a single comment's thread. Return to all comments →
try this out.it worked for me.and it is in java
static void beautifulDays(int i, int j, int k) { int cnt=0; for(int p=i;p<=j;p++) {int tmp=p,r=0; while(tmp>0) {r=r10+tmp%10; tmp/=10;} if(((p-r)%k)==0) {cnt+=1;} } System.out.println(cnt); }
Seems like cookies are disabled on this browser, please enable them to open this website
Beautiful Days at the Movies
You are viewing a single comment's thread. Return to all comments →
try this out.it worked for me.and it is in java
static void beautifulDays(int i, int j, int k) { int cnt=0; for(int p=i;p<=j;p++) {int tmp=p,r=0; while(tmp>0) {r=r10+tmp%10; tmp/=10;} if(((p-r)%k)==0) {cnt+=1;} } System.out.println(cnt); }