Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void main () {
- int i, j, s, c = 0;
- for (i = 2; c < 5; i += 2) {
- s = 0;
- for(j = 1; j < i; j++) {
- if (i % j == 0) {
- s += j;
- }
- }
- if (s == i) {
- printf("Numero %i e perfeito!\n", i);
- c++;
- }
- }
- }
- #include <stdio.h>
- #include <stdlib.h>
- #include <cmath>
- main()
- {
- int n,a,b,c,num,n=1;
- while(num<=6)
- {
- b=pow(2,n-1);
- c=b*(pow(2,n)-1);
- a++;
- }
- printf("%d \n", c);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement