Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while(scanf("%d%d",&q,&p)==2){ //
- int sum=0;
- double t;
- //if ( q == 10&& P==10)
- //{break;}
- t=(double)q/p;
- sum+=t;
- printf("[%d;",(int)t);
- q=q-(int)t*p;
- SWAP(q,p);
- t=(double)q/p;
- sum+=t;
- printf("%d",(int)t);
- q=q-(int)t*p;
- while(q!=0){
- SWAP(q,p);
- t=(double)q/p;
- sum+=t;
- printf(",%d",(int)t);
- q=q-(int)t*p}
- printf("]n");
- array[count]=sum;
- printf("%dn",sum);
- printf("%dn",count);
- for(j=0;j<=count;j++)
- {printf("%dn",array[j]);}
- count++;
- if( count == 3) {
- // terminate the loop using break statement
- break;
- }
- }//end while
Add Comment
Please, Sign In to add comment