Write a program to print the product of the first 10 even numbers.
Sample Output
Sample Solution
C# Sharp Codeusing System; using System.Collections.Generic; using System.Text; namespace Divisible { class Even_Number { static void Main(string[] args) { int nNum, nEven; double nProd; nNum = 2; nEven = 0; nProd = 1; while (nEven < 10) { nProd = nNum * nProd; nNum = nNum + 2; nEven = nEven + 1; Console.WriteLine("The first 10 even numbers is:{0}", nProd); } Console.ReadLine(); } } }
Sample Output
No comments:
Post a Comment