# include <iostream.h> # include <conio.h> void binary_code(int); void main( ) { clrscr( ); textmode(BW80); int n; int bits; cout<<\"\\n Enter the value of n = \"; cin>>n; cout<<\"\\n The Binary code of value of n = \"; binary_code(n); cout<<\"\\n\\n Enter the number of bits to shift right = \"; cin>>bits; n=n>>bits; cout<<\"\\n The value of n after Right Shifting = \"<<n; cout<<\"\\n\\n The Binary code of modified value of n = \"; binary_code(n); getch( ); } //--------------------------- binary_code( ) --------------------------// void binary_code(int number) { int remainder; int qutiont; int count=0; int x=(wherex( )+16); int y=wherey( ); if(number>0) { while(number>0) { qutiont=number/2; remainder=number%2; number=qutiont; gotoxy((x-count),y); cout<<remainder; count++; } } else { gotoxy((x-count),y); cout<<\"0\"; } }