TechSapphire Monday, 2024-12-09, 3:56 PM
Site menu
Login form
News
Play Games
  • Deep Freeze
  • Ice Slide
  • Gyroball
  • Fat Fish
  • Bush Royal Rampage
  • How to divide any number with 256 without using arithmetic operator?

    Solution:

    #include<stdio.h>

    #include<conio.h>

    int main()

    {                          

        int num;

        printf("Enter any number:");

        scanf("%d",&num);

        printf("After number divided by 256 = %d ",num>>8);

        getch();

    }

    Explanation:

    How this code work?

    For this you should know about >> operator. This is right shift operator. Now num>>8 means to shift number 8 binary character to right. Because 2 8 represent 256 in binary.


     

    Categories
    Programming [27]
    Tips for programming
    Security [2]
    Security Tips
    Google [1]
    Use google faster then ever you use
    Project [14]
    HTML [2]
    Electronics [0]
    Data Structure [0]
    Database [16]
    SQL SERVER
    SSRS [1]
    Sql Server Reporting Services
    Copyright MyCorp © 2024