Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace LesonLoop_2
- {
- class Loop_2
- {
- static void Main(string[] args)
- {
- Console.Write("n = ");
- int n = int.Parse(Console.ReadLine());
- int p3 = 3;
- int p4 = 4;
- int p5 = 5;
- int p24 = 24;
- int p25 = 25;
- int p26 = 26;
- int maskP3 = 1 << p3;
- int maskP4 = 1 << p4;
- int maskP5 = 1 << p5;
- int maskP24 = 1 << p24;
- int maskP25 = 1 << p25;
- int maskP26 = 1 << p26;
- int newN3 = n&(~maskP3);
- int newN4 = n&(~maskP4);
- int newN5 = n&(~maskP5);
- int newN24 = n&(~maskP24);
- int newN25 = n&(~maskP25);
- int newN26 = n&(~maskP26);
- int bit3 = newN3 ^ n;
- int bit4 = newN4 ^ n;
- int bit5 = newN5 ^ n;
- int bit24 = newN24 ^ n;
- int bit25 = newN25 ^ n;
- int bit26 = newN26 ^ n;
- if ((bit3 >> p3) == (bit24 >> p24))
- {
- if ((bit4 >> p4) == (bit25 >> p25))
- {
- if ((bit5 >> p5) == (bit26 >> p26))
- {
- Console.WriteLine("n= " + n);
- }
- else
- {
- int endBit5 = n ^ maskP5;
- int endBit526 = endBit5 ^ maskP26;
- Console.WriteLine("endBit526 = " + endBit526);
- }
- }
- else
- {
- int endBit4 = n ^ maskP4;
- int endBit425 = endBit4 ^ maskP25;
- int endBit425526 = (endBit425 ^ maskP5) ^ maskP26;
- Console.WriteLine(((bit5 >> p5) == (bit26 >> p26)) ? ("endBit425 = " + endBit425) : ("endBit425526 = " + endBit425526));
- }
- }
- else
- {
- if ((bit4 >> p4) == (bit25 >> p25))
- {
- if ((bit5 >> p5) == (bit26 >> p26))
- {
- int endBit3 = n ^ maskP3;
- int endBit324 = endBit3 ^ maskP24;
- Console.WriteLine("endBit324 = " + endBit324);
- }
- else
- {
- int endBit3 = n ^ maskP3;
- int endBit324 = endBit3 ^ maskP24;
- int endBit3245 = endBit324 ^ maskP5;
- int endBit324526 = endBit3245 ^ maskP26;
- Console.WriteLine("endBit324526 = " + endBit324526);
- }
- }
- else
- {
- int endBit3 = n ^ maskP3;
- int endBit324 = endBit3 ^ maskP24;
- int endBit3244 = endBit324 ^ maskP4;
- int endBit324425 = endBit3244 ^ maskP25;
- int endBit324425526 = ((endBit324425^maskP5)^maskP26);
- Console.WriteLine(
- ((bit5>>p5)==(bit26>>p26)) ? ("endBit324425 = " + endBit324425) : ("endBit324425526 = " + endBit324425526));
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement