pablosotol

Guia Programacion 1 - Ejercicio 21

Mar 31st, 2015
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.24 KB | None | 0 0
  1. #include<stdio.h>
  2. int main(){
  3.     int i,a,x,b;
  4.     printf("Ingrese el numero que desea transformar a gray:  ");
  5.     scanf("%d",&x);
  6.     for(i=0;i<=x;i++){
  7.     a=i>>1;
  8.     b=a^i;
  9.     printf("\nCodigo gray de %d es: %d",i,b);
  10.     }
  11.  
  12.  
  13. }
Advertisement
Add Comment
Please, Sign In to add comment