Advertisement
Guest User

Untitled

a guest
May 29th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. void main () {
  4.     int i, j, s, c = 0;
  5.     for (i = 2; c < 5; i += 2) {
  6.         s = 0;
  7.         for(j = 1; j < i; j++) {
  8.             if (i % j == 0) {
  9.                 s += j;
  10.             }
  11.         }
  12.         if (s == i) {
  13.             printf("Numero %i e perfeito!\n", i);
  14.             c++;
  15.         }
  16.     }
  17. }
  18.  
  19. #include <stdio.h>
  20. #include <stdlib.h>
  21. #include <cmath>
  22.  
  23. main()
  24. {
  25.     int n,a,b,c,num,n=1;
  26.     while(num<=6)
  27.     {
  28.         b=pow(2,n-1);
  29.         c=b*(pow(2,n)-1);
  30.         a++;      
  31.     }
  32.     printf("%d \n", c);
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement