Wednesday, 24 April 2013

Write a program to print the product of the first 10 even numbers. (Duration: 30 min)


using System;
using System.Collections.Generic;
using System.Text;
 namespace Divisible
{
class product_Even
{
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 product of first 10 even numbers is:{0}",nProd);
    }
}
}
}

No comments:

Post a Comment