daily pastebin goal
69%
SHARE
TWEET

Untitled

a guest Feb 19th, 2019 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top