[ create a new paste ] login | about

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

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

int main()
{
 int i,x,p,n,y,t;
 scanf("%d %d %d %d",&x,&y, &n, &p);
 for(i = 0;i < n;i++)
 {
  t = (y >> i) & 1; 
  x = (x | (128 >> (p+i))) & (t << i) ;
       
 }
 printf("%d", x);
 getch();
 
 return 0;
}


Output:
1
Line 18: error: conio.h: No such file or directory


Create a new paste based on this one


Comments: