View difference between Paste ID: kPG4ZWBs and it3mwhPs
SHOW: | | - or go back to the newest paste.
1
#include <stdio.h>
2
#include <math.h>
3
4
main(){
5
        int n,i,a,p,somme,count;
6
        count=0;
7
        for( n=1; n<1000; n++ ){
8
                somme=0;
9
                a=n;
10-
                p=((int) ((log(n))/(log(2))));
10+
                p=(int) ((log(n))/(log(2)));
11
                for( i=1; i<=p; i++ ){
12
                        a=(int) a/2;
13
                        somme+=a;
14
                }
15
                if( somme==n-1 ){
16
                        count++;
17
                        printf("%d ", n);
18
                }
19
        }
20
        printf("\nNombre d'entiers repondant au probleme : %d\n", count);
21
}