[ create a new paste ] login | about

Link: http://codepad.org/4dV53vuL    [ raw code | output | fork ]

C, pasted on Jul 2:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include<stdio.h>

int main(){
    int m=2;
    int n=10;
    int ans=1;
    while(0<n){
        if(n&1){
            ans*=m;
        }
        m*=m;
        n>>=1;
    }
    printf("%d",ans);
    return 0;
}


Output:
1
1024


Create a new paste based on this one


Comments: