[ create a new paste ] login | about

Link: http://codepad.org/3LWcnIt9    [ raw code | output | fork ]

C, pasted on Aug 2:
//C hello world example
#include <stdio.h>
int main()
{

	int t = 1 ;
	int i = 1 ;

	for(i = 1; i < 10; i++) {
		printf("%d << %d = %d \n", t, i, t << i);
	}
	
        printf("\n");
	
	t = 512;
	
	for(i = 1; i < 10; i++) {
		printf("%d >> %d = %d \n", t, i, t >> i);
	}    

  return 0;
}


Output:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
1 << 1 = 2 
1 << 2 = 4 
1 << 3 = 8 
1 << 4 = 16 
1 << 5 = 32 
1 << 6 = 64 
1 << 7 = 128 
1 << 8 = 256 
1 << 9 = 512 

512 >> 1 = 256 
512 >> 2 = 128 
512 >> 3 = 64 
512 >> 4 = 32 
512 >> 5 = 16 
512 >> 6 = 8 
512 >> 7 = 4 
512 >> 8 = 2 
512 >> 9 = 1 


Create a new paste based on this one


Comments: