[ create a new paste ] login | about

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

C, pasted on Jun 24:
main(){
int a, b, c, d, e, f, Ka2, a_Avg, b_Avg, c_Avg, d_Avg, e_Avg, f_Avg;
   Ka2 = 1024;

   a_Avg = 0 + 2048;
   b_Avg = (255 * 4096) + 2048;
   c_Avg = 1 + 2048;
   d_Avg = ((255 * 4096) - 1) + 2048;
   e_Avg = (255 * 4096) - ((255 * 4096) - (254 * 4096))/2 + 2048;
   f_Avg = e_Avg - 1;

   a = (Ka2 * (a_Avg / 4096) + 512)/1024;
   b = (Ka2 * (b_Avg / 4096) + 512)/1024;
   c = (Ka2 * (c_Avg / 4096) + 512)/1024;
   d = (Ka2 * (d_Avg / 4096) + 512)/1024;
   e = (Ka2 * (e_Avg / 4096) + 512)/1024;
   f = (Ka2 * (f_Avg / 4096) + 512)/1024;

   printf("A=%d\n", a);
   printf("B=%d\n", b);
   printf("C=%d\n", c);
   printf("D=%d\n", d);
   printf("E=%d\n", e);
   printf("F=%d\n", f);
return 0;
}


Output:
1
2
3
4
5
6
A=0
B=255
C=0
D=255
E=255
F=254


Create a new paste based on this one


Comments: