Guest User

Untitled

a guest
Nov 21st, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.42 KB | None | 0 0
  1. using System;
  2.                    
  3. public class Program
  4. {
  5.     public static void Main()
  6.     {
  7.         int db = 10;
  8.         int [] T = new int[db];
  9.        
  10.         Random vszam = new Random();
  11.         for(int i=0; i<db; i++){
  12.             T[i]=vszam.Next(-10,10);
  13.             Console.Write(T[i]);
  14.             if(i<db-1) Console.Write(" ");
  15.         }
  16.        
  17.         int elofordul=0;
  18.         for(int i=0; i<db-1; i++) {
  19.             if(T[i]>0 && T[i+1]<0) elofordul++;
  20.         }
  21.                
  22.         Console.WriteLine("\n"+elofordul);
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment