Blogger Tips And Tricks|Latest Tips For Bloggers Free Backlinks

Friday, 16 November 2012

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

1 comments: