using System;
public class 순위
{
public static void Main(string[] args)
{
//배열선언과 동시에 초기화
int[] score = { 90, 87, 100, 95, 80 };
int[] rank = { 1, 1, 1, 1, 1 };
for (int i = 0; i < score.Length; i++)
{
for (int j = 0; j < score.Length; j++)
{
if (score[i] < score[j])
{
rank[i]++;
}
}
}
for (int i = 0; i < score.Length; i++)
{
Console.WriteLine("{0}점 : {1}등", score[i], rank[i]);
}
}
}
'.Net Project > .Net C#' 카테고리의 다른 글
33장 1~100까지 합중 3의 배수 그리고 4의 배수의 합 (0) | 2009.08.10 |
---|---|
32장 알고리즘(선택정렬) (0) | 2009.08.10 |
31장 StopWatch (0) | 2009.08.10 |
30장 Random Class(랜덤 클래스) (0) | 2009.08.10 |
29장 환경변수 (0) | 2009.08.10 |