Skip to content

Instantly share code, notes, and snippets.

@antonio-abrantes
Created July 21, 2016 00:17
Show Gist options
  • Save antonio-abrantes/b39998a8806d51726aef1fcbceba902e to your computer and use it in GitHub Desktop.
Save antonio-abrantes/b39998a8806d51726aef1fcbceba902e to your computer and use it in GitHub Desktop.
Soma de Divisores
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n, i;
scanf("%d",&n);
int soma = 0;
for(i = 1;i <= (n/2); i++){ //Calcular a soma dos divisores sem incluir o numero de entrada...
if(n % i == 0){
soma = soma + i;
}
}
printf("A soma e: %d \n",soma);
system("PAUSE");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment