Blog

Output of following code:

static void Main(string[] args){
int[] numArray = { 11,2,3,51,33,22,4,5,8};
int num1 = 0,num2=0;
for (int i = 0; i < numArray.Length; i++){
if (numArray[i] % 3==0){
num1 += numArray[i];
}else if (numArray[i] % 5 == 0){
num2 += numArray[i];
}
}
Console.WriteLine(“num1: {0}”,num1);
Console.WriteLine(“num2: {0}”, num2);
}