Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.62 KB | None | 0 0
  1. /*Cire um programa que lê um número natural n do teclado e imprime todos os divisores desse número. Ao final, imprima também a soma dos divisores encontrados*/
  2. #include<stdio.h>
  3.  
  4.  
  5. int main()
  6. {
  7.         int n, div, soma, count;
  8.  
  9.         printf("Entre com o número\n");
  10.         scanf("%d", &n);
  11.  
  12.         soma = 0;
  13.         div = 0;
  14.  
  15.         for(count = 1; count <= n; count++ )
  16.                 if(count % n == 0) {
  17.                         div = count;
  18.                         soma += div;
  19.  
  20.                         printf("%d\n", count);
  21.                 }
  22.  
  23.         printf("%d\n", soma);
  24.         return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement