You are viewing a single comment's thread. Return to all comments →
How can i improve this code ... bcoz im geting time out in all test case except first 1,,,
#include <stdio.h> #include <stdlib.h> int main() {int sum,count=0,temp=0,y,i,j,n,rem,z,t; scanf("%d",&t); for(j=0;j<t;j++) {scanf("%d",&n); for(i=11;i<n;i++) { sum=0; y=i; while(y!=0) { rem=y%10; sum=(sum*10)+rem; y=y/10; } sum=sum+i; if((i%10)==0) { continue; } else {while(sum!=0) { y=sum%10; if(y%2==0) { temp=1; break; } sum=sum/10; }} if(temp!=1) { count=count+1; } temp=0; } printf("%d\n",count); count=0; } }
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #145: How many reversible numbers are there below one-billion?
You are viewing a single comment's thread. Return to all comments →
How can i improve this code ... bcoz im geting time out in all test case except first 1,,,