Advertisement
tomateblue

APS-3_CasoParaImprimirPOrUltimo.c

Dec 4th, 2016
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int numeroperfeito(int n)
  4. {
  5.     int i, z=0;
  6.     int v[100] = {}; // maximo 100
  7.  
  8.  
  9.     for(i = 1 ; i < n ; i++ )
  10.     {
  11.         if( n%i == 0 )
  12.         {
  13.                    v[i-1] = i;
  14.                   return v[i-1];
  15.         }
  16.     }
  17. }
  18.  
  19.  
  20. void main()
  21. {
  22.     int n,i;
  23.     int vetor[] = {};
  24.     scanf("%d",&n);
  25.     for (i = 0; i < n; i++){
  26.         vetor[i] = numeroperfeito(n);
  27.     }
  28.  
  29.     for (i = 1; i < n ; i ++ ){
  30.        printf("%d",vetor[i]);
  31.    }
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement