SHARE
TWEET

Untitled

a guest Oct 22nd, 2019 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "stdafx.h"
  2. #include <stdio.h>
  3. #include <Windows.h>
  4. #include <locale.h>
  5.  
  6. int get_massive(int num) {
  7.     int a[10];
  8.     int temp;
  9.     temp = num;
  10.     for (int k = 0; k < 10; k++) {
  11.         a[k] = temp % 2;
  12.         temp = temp / 2;
  13.     }
  14.     return ;
  15. }
  16.  
  17. int find_two(int num){
  18.     int b[10];
  19.     int temp;
  20.     temp = num;
  21.     for (int k = 0; k < 10; k++) {
  22.         b[k] = temp % 2;
  23.         temp = temp / 2;
  24.     }
  25.     int l, dva;
  26.     dva = 0;
  27.     l = 1;
  28.     for (int k = 9; k >= 0; k--) {
  29.         dva = dva + b[k] * l;
  30.         l = l * 2;
  31.     }
  32.     return dva;
  33. }
  34.  
  35. int _tmain(int argc, _TCHAR* argv[])
  36. {
  37.     int a[10];
  38.     int m;
  39.     setlocale(LC_ALL, "Rus");
  40.     for (m = 512; m < 1024; m++) {
  41.         printf("%d\t", m);
  42.         get_massive(m);
  43.         printf("%d\n", find_two(m));
  44.     }
  45.     system("pause");
  46.     return 0;
  47. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top