Cod sursa(job #840578)

Utilizator gabriel.badeaGabriel Badea gabriel.badea Data 22 decembrie 2012 21:43:37
Problema Suma divizorilor Scor 0
Compilator c Status done
Runda Arhiva de probleme Marime 0.58 kb
#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <stdlib.h>

int main(void)
{
	FILE *f1, *f2;
	int a, b, c, i;
	long int p, s = 0;
	if(( f1 = fopen("sumdiv.in", "r")) == NULL)
	{
		printf(" Could not open the file.");
		_getch();
		exit(1);
	}

	fscanf(f1,"%d%d", &a, &b);
	c = a;
	for(i=1;i<b;i++)
		a *= c;
	if((f2 = fopen("sumdiv.out", "w")) == NULL)
	{
		printf(" Could not open the file 2.");
		_getch();
		exit(1);
	}
	for(i=2;i<=a/2;i++)
		if(a % i == 0)
			s += i;
	s += 1;
	s += a;
	fprintf(f2,"%ld", s % 9901);
	_getch();
}