Facebook
From Buff Tortoise, 4 Years ago, written in C++.
Embed
Download Paste or View Raw
Hits: 180
  1. #include <stdio.h>
  2. #include<iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int x, y, liczba, wynik;
  9.     cin>>liczba;
  10.     unsigned int mask_1=1;
  11.     unsigned int mask_2=0x80000000;
  12.  
  13.     for(int i=0; i<16; i++)
  14.     {
  15.        x=(liczba & mask_1);
  16.        y=(liczba & mask_2);
  17.  
  18.         if((x^y))
  19.         {
  20.                 wynik=0;
  21.                 break;
  22.         }
  23.  
  24.         else
  25.         {
  26.                 wynik=1;
  27.                 mask_1<<=1;
  28.                 mask_2>>=1;
  29.             }
  30.     }
  31.  
  32.     cout<<wynik;
  33.  
  34.         return 0;
  35. }
  36.  

Replies to Untitled rss

Title Name Language When
Re: Untitled Colossal Meerkat cpp 4 Years ago.