C#
16.C# - 카운트
Godffs
2009. 8. 5. 20:45
반응형
using System;
public class 카운트
{
public static void Main(string[] args)
{
//[1] Input
int[] data = { 10, 9, 4, 7, 6, 5 };
int count = 0; //카운트 저장
//[2] Process : COUNT
for (int i=0; i < data.Length; i++)
{
if (data[i] % 2 == 0)
{
count ++;//카운트 증가(누적)
}
}
//[3] Output
Console.WriteLine("짝수건수 : {0}", count);
}
}
public class 카운트
{
public static void Main(string[] args)
{
//[1] Input
int[] data = { 10, 9, 4, 7, 6, 5 };
int count = 0; //카운트 저장
//[2] Process : COUNT
for (int i=0; i < data.Length; i++)
{
if (data[i] % 2 == 0)
{
count ++;//카운트 증가(누적)
}
}
//[3] Output
Console.WriteLine("짝수건수 : {0}", count);
}
}
반응형