/* קלט: מספר שלם ולאחריו רשימת מספרים שלמים גדולים מ-1 שמסתיימת ב-0 פלט: אם המספר הראשון זוגי יוצגו המספרים ברשימה פעמיים, אחרת יוצגו המספרים ברשימה פעם אחת בלבד */ using System; public class IfEven { public static void Main() { int num; // המספר הראשון בקלט int numInList; // מספר תורן ברשימת הקלט bool isEven; //האם המספר הראשון זוגי // קליטת המספר הראשון ובדיקה האם הוא זוגי Console.Write("Enter the first number: "); num = int.Parse(Console.ReadLine()); isEven = (num % 2 == 0); Console.Write("Enter a number. Type 0 to end the list: "); numInList = int.Parse(Console.ReadLine()); while (numInList != 0) { if (isEven) Console.Write("{0} {1} ", numInList, numInList); else Console.WriteLine(numInList); Console.Write("Enter the next number. Type 0 to end the list: "); numInList = int.Parse(Console.ReadLine()); } // while }// Main }// IfEven