Quick actions

cmd+k|ctrl+k

Navigation

Languages

prime div

Snippet info

Language

C

Visibility

public

Author

hyrious

Created

2019-11-18T02:38:01Z

Updated

2019-11-18T02:38:01Z

#define _CRT_SECURE_NO_WARNINGS

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

int main(void) {
    int Primes[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47};

    bool f = true;
    int i, n, e;
    scanf("%d", &n);
    for (i = 0; i < sizeof(Primes) && n > 1; ++i) {
        for (e = 0; n % Primes[i] == 0; n /= Primes[i]) {
            e++;
        }
        printf(f ? "%d" : ", %d", e);
        f = false;
    }
    printf("\n");

    return 0;
}
INFO