namespace SwitchFor { class Program { static void Main(string[] args) { int i = 3; int j = 5; uint s = 0; char n; for (int a = 0; a < 5; a++ ) { Console.WriteLine("ΠΠ²Π΅Π΄ΠΈΡΠ΅ ΠΌΠ΅ΡΠΊΡ 1, 2, 3, 4, 5"); n = (char)Console.Read(); switch (n) { case '1': { j = j - i; s = s + (uint)j; } break; case '2': { j = j + i * 3; s = s + (uint)j; } break; case '3': { j = j--; s = s + (uint)j; } break; case '4': { j = (i - 5) * 2; s = s + (uint)j; } break; case '5': { j = i + j + 1; s = s + (uint)j; } break; default: { s = s + 1; } break; } } Console.WriteLine("Π‘ΡΠΌΠΌΠ° ΡΠ°Π²Π½Π° "+s); Console.ReadKey(); } } }
This is such a simple program, however, for some reason it works for me incorrectly.
ΠΡΠ²ΠΎΠ΄ Π΄ΠΎΠ»ΠΆΠ΅Π½ Π±ΡΡΡ ΡΠ°ΠΊΠΈΠΌ: ΠΠ²Π΅Π΄ΠΈΡΠ΅ ΠΌΠ΅ΡΠΊΡ 1, 2, 3, 4, 5 1 ΠΠ²Π΅Π΄ΠΈΡΠ΅ ΠΌΠ΅ΡΠΊΡ 1, 2, 3, 4, 5 2 ΠΠ²Π΅Π΄ΠΈΡΠ΅ ΠΌΠ΅ΡΠΊΡ 1, 2, 3, 4, 5 3 ΠΠ²Π΅Π΄ΠΈΡΠ΅ ΠΌΠ΅ΡΠΊΡ 1, 2, 3, 4, 5 4 ΠΠ²Π΅Π΄ΠΈΡΠ΅ ΠΌΠ΅ΡΠΊΡ 1, 2, 3, 4, 5 5 Π‘ΡΠΌΠΌΠ° ΡΠ°Π²Π½Π° (ΠΈ ΠΊΠ°ΠΊΠΎΠ΅-ΡΠΎ ΡΠΈΡΠ»ΠΎ, ΠΏΠΎΠ»ΡΡΠ΅Π½Π½ΠΎΠ΅ Π² ΡΠ΅Π·ΡΠ»ΡΡΠ°ΡΠ΅ ΡΡΠΈΡ
ΠΏΡΡΠΈ Π΄Π΅ΠΉΡΡΠ²ΠΈΠΉ).
n = Console.ReadLine()[0];
? - alexlz