Advertisement
Guest User

Untitled

a guest
Feb 15th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <stdio.h>
  3. #include "testing.h"
  4.  
  5. int main()
  6. {
  7.     int N, a, b, c, d, e, f, g;
  8.  
  9.     scanf("%d", &N);
  10.  
  11.     a = N / 100000 % 10;
  12.     b = N / 10000 % 10;
  13.     c = N / 1000 % 10;
  14.     d = N / 100 % 10;
  15.     e = N / 10 % 10;
  16.     f = N % 10;
  17.  
  18.     if (b < a && b < c)
  19.     {
  20.         g = a;
  21.         a = b;
  22.         b = g;
  23.     }
  24.  
  25.     if (c < a && c < b)
  26.     {
  27.         g = a;
  28.         a = c;
  29.         c = g;
  30.     }
  31.  
  32.     if (c < b)
  33.     {
  34.         g = b;
  35.         b = c;
  36.         c = g;
  37.     }
  38.  
  39.     if (e < d && e < f)
  40.     {
  41.         g = d;
  42.         d = e;
  43.         e = g;
  44.     }
  45.  
  46.     if (f < d && f < e)
  47.     {
  48.         g = d;
  49.         d = f;
  50.         f = g;
  51.     }
  52.  
  53.     if (f < e)
  54.     {
  55.         g = e;
  56.         e = f;
  57.         f = g;
  58.     }
  59.  
  60.     if (a == d && b == e && c == f)
  61.     {
  62.         printf("Number is lucky");
  63.     }
  64.  
  65.     else
  66.     {
  67.         printf("Number is not lucky");
  68.     }
  69.  
  70.     return 0;
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement