/******************************************************/ /* Introduction to Programming */ /* By Dr. ANTF */ /* www.antf.net */ /* Copyright 2015 */ /* */ /* C# 333 - Test 1: Problem 5 */ /******************************************************/ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DOS { class Program { static void Main(string[] args) { int num, i, sum, count = 0; Console.Write("Please entere a number: "); num = int.Parse(Console.ReadLine()); Console.WriteLine("\n"); while (count < 3) { //check for prime for (i = 2; i < num; i++) { if (num % i == 0) break; } if (i == num) { //find the sum of the digits sum = 0; int temp = num; while (temp != 0) { sum = sum + (temp % 10); temp = temp / 10; } //check if the sum is even if (sum % 2 == 0) { Console.Write("{0}, ", num); count++; } } num++; } Console.Write("\b\b."); Console.ReadKey(); } } }