summaryrefslogblamecommitdiffstats
path: root/mat/advent/4/n1.c
blob: 157d60d6a25d65998c728127484b95d040968e5c (plain) (tree)





















                                                                                                                                                                
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main (int argc, char ** argv) {
	if (argc != 1+2) {
		fprintf(stderr, "uporaba: %s <število> <število>\nprimer-število deliteljev 3019, ki niso delitelji 2020: %s 3019 2020\n", argv[0], argv[0]);
		return 1;
	}
	unsigned long int n = strtol(argv[1], NULL, 10);
	unsigned long int o = strtol(argv[2], NULL, 10);
	unsigned long int i = 0;
	unsigned long int s = 0;
	unsigned long int d = 0;
	for (i = 1; i <= n; i++)
		if (n % i == 0) {
			d++;
			if (o % i != 0)
				s++;
		}
	fprintf(stdout, "števil, ki delijo %lu (=%lu), ne pa %lu, je %lu\n", n,d,o,s);
	return 0;
}