Levi0227

8. heti házi

Nov 8th, 2023 (edited)
557
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.93 KB | Source Code | 0 0
  1. namespace PMPHF007_P99J7Y
  2. {
  3.     internal class PMPHF007_P99J7Y
  4.     {
  5.         static void Main(string[] args)
  6.         {
  7.             string s = Console.ReadLine();
  8.             int[] b = new int[s.Length / 2];
  9.  
  10.             int index = 0;
  11.             for (int i = 0; i < s.Length; i += 2)
  12.             {
  13.                 string eleje = s.Substring(i, 2);
  14.                 int kettesszamok = int.Parse(eleje);
  15.                 b[index] = kettesszamok;
  16.                 index++;
  17.             }
  18.  
  19.             Console.Clear();
  20.  
  21.             for (int i = 0; i < b.Length; i++)
  22.             {
  23.                 if (b[i] >= 0 && b[i] <= 8)
  24.                 {
  25.                     Console.Write(0);
  26.                 }
  27.                
  28.                 else if (b[i] >= 27 && b[i] <= 50)
  29.                 {
  30.                     Console.Write(1);
  31.                 }
  32.  
  33.                 else { Console.Write('E'); }
  34.             }
  35.  
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment