View Code of Problem 4054

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>


int main(){
	int t,n;
	scanf("%d",&t);
    while( t -- ){
        scanf("%d",&n);
        int a[6] = {100,50,10,5,2,1};
        int b[6] = {0};
        for(int j = 0;j < 6;j++){
            b[j] = n / a[j];
            n %= a[j];
        }
        for(int i = 0;i < 6;i++){
            if(i == 0){
                printf("%d",b[i]);
            }else{
                printf(" %d",b[i]);
            }
        }
        printf("\n");
    }
	return 0;
}

Double click to view unformatted code.


Back to problem 4054