Translate

Thursday 18 September 2014

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

answer:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace product_of_first_10_even_numbers
{
    class pgm
    {
        static void Main(string[] args)
        {
            int i, j;
            int product = 1;
            for (i = 2; i <= 10; i=i + 2)
            {
                 product = product * i;
            }
            Console.WriteLine("product of first 10 even numbers:" + product);
            Console.Read();
        }
    }
}

No comments:

Post a Comment