Blogger Tips And Tricks|Latest Tips For Bloggers Free Backlinks
Showing posts with label shift operations. Show all posts
Showing posts with label shift operations. Show all posts

Friday, 16 November 2012

Write a program to right Shift the given number using in C language examples?

Right Shift,right shift in C,program to right shift,right shift the given number,right shift the number,C right shift,write a program to right shift,right shift the given number using C,Write a program to right Shift the given number using in C language,C language right shift


 Right Shift

               If you Right shift the given number,the given value will become half to actual value.
               Suppose the given Right shift number is 2(input),output is 1
                                                                        6(input),output is 3
                                                                        9(input),output is 4
                  
                   The above logic is blind way to remember the left shift logic.


                  #include<stdio.h>
                   main()
                   {
                         int n,ls;

                           printf("Enter number\n");
                           scanf("%d",&n);

                                ls = n >> 1;

                            printf("After Right shift : %d\n",ls);
                    }

          Output:
                       Enter the number
                              10
                        After Right shift 5


Write a program to Left Shift the given number using in C language examples?

Left Shift,left shift in C,program to left shift,left shift the given number,left shift the number,C left shift,write a program to left shift,left shift the given number using C,Write a program to Left Shift the given number using in C language,C language left shift


Left Shift

               If you left shift the given number,the given value will become double to actual value.
               Suppose the given left shift number is 4(input),output is 8
                                                                        2(input),output is
                                                                        3(input),output is 6
                  
                   The above logic is blind way to remember the left shift logic.

   Program  

                 #include<stdio.h>
                   main()
                   {
                         int n,ls;

                           printf("Enter number\n");
                           scanf("%d",&n);

                                ls = n << 1;

                            printf("After left shift : %d\n",ls);
                    }

          Output:
                       Enter the number
                             4
                        After left shift  8