Introduction
This code snippet is Print multiplication of n values in an arrays using C#
Code
The following code will print multiplication value of 2 in an array like 0,2,4.
using System;
public class Program
{
public static void Main()
{
int i = 2; // Multiply by 2
string[] Array = {"India","Pakisthan","USA","UK","China","Japan"};
for (int j = 0; j <= Array.Length - 1; j++)
{
if (j % i == 0) // divided by i value
{
Console.WriteLine(Array[j]);
}
}
}
}
Output India
USA
China
USA
China
Demo : https://dotnetfiddle.net/AnI5N9
