Advertisement
Guest User

list print

a guest
Feb 21st, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.56 KB | None | 0 0
  1. int [] list = new int[] {1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89};
  2.         int [] newList = new int [11];
  3.         for (int i = 0; i < 11; i++)
  4.         {
  5.             if (list[i] <= 5)
  6.             {
  7.                 newList[i] = list[i];
  8.             }
  9.         }
  10.  
  11.         Console.Write("a= ");
  12.        
  13.         for (int i = 0; i < 11 ; i++)
  14.         {
  15.             if (newList[i] <= 5)
  16.             {
  17.                 Console.Write(newList[i] + " ");
  18.             }
  19.             if ( i == 4)
  20.             {
  21.                 break;
  22.             }
  23.            
  24.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement