algorithms/greedy/sherlock-and-the-beast.c
void decentNumber(int n) {
    for (int fives = (n / 3) * 3; fives >= 0; fives -= 3) {
        int threes = n - fives;
        if (threes % 5 == 0) {
            for (int i = 0; i < fives; i++) {
                printf("5");
            }
            for (int i = 0; i < threes; i++) {
                printf("3");
            }
            printf("\n");
            return;
        }
    }
    printf("-1\n");
}
/*
 * Complete the 'decentNumber' function below.
 *
 * The function accepts INTEGER n as parameter.
 */
Complete the 'decentNumber' function below.
The function accepts INTEGER n as parameter.
Complete the ' decentNumber ' function below . The function accepts INTEGER n as parameter .
void decentNumber(int n) {
    for (int fives = (n / 3) * 3; fives >= 0; fives -= 3) {
        int threes = n - fives;
        if (threes % 5 == 0) {
            for (int i = 0; i < fives; i++) {
                printf("5");
            }
            for (int i = 0; i < threes; i++) {
                printf("3");
            }
            printf("\n");
            return;
        }
    }
    printf("-1\n");
}
void decentNumber ( int n ) { for ( int fives = ( n / 3 ) * 3 ; fives >= 0 ; fives -= 3 ) { int threes = n - fives ; if ( threes % 5 == 0 ) { for ( int i = 0 ; i < fives ; i ++ ) { printf ( " " ) ; } for ( int i = 0 ; i < threes ; i ++ ) { printf ( " " ) ; } printf ( " \n " ) ; return ; } } printf ( " \n " ) ; }
Complete the 'decentNumber' function below.
Complete the ' decentNumber ' function below .