Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.51 KB | None | 0 0
  1. using System;
  2.  
  3. public class MyProgram
  4. {
  5.     private static Random random = new Random();
  6.    
  7.     public static void Main(string[] args)
  8.     {
  9.         int i, p, a;
  10.        
  11.         p = 0;
  12.         for (i = 1; i <= 20; i++)
  13.         {
  14.             a = random.Next(101) - 50;
  15.             Console.Write(Convert.ToString(a) + " ");
  16.             if (Math.Abs(a) % 2 == 0)
  17.             {
  18.                 p = p + 1;
  19.             }
  20.         }
  21.        
  22.         Console.WriteLine("\npรกrosok szรกma: " + p);
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement