Monday, September 03, 2007

One Line Modified

Opps, I made a boo boo.


int a,p,q,r;
main(){
for(;a>1?0==a%5?(a=a/5,p++):0==a%3?(a=a/3,q++):(a=a/2,r++):scanf("%d",&a);a-1||(printf("p, q, r = %d %d %d\n", p, q, r),p=q=r=a=0));
}


I have to change p++ -> ++p, q++ -> ++q, r++ -> ++r. And a=a/2 -> a/=2..


int a,p,q,r;
main(){
for(;a>1?0==a%5?(a/=5,++p):0==a%3?(a/=3,++q):(a/=2,++r):scanf("%d",&a);a-1||(printf("p, q, r = %d %d %d\n", p, q, r),p=q=r=a=0));
}


That can be better.

0 Comments:

Post a Comment

<< Home