C#/수업내용
2020.04.06. 수업내용 - for문, if문 3 (아이스크림)
dev_sr
2020. 4. 6. 23:56
6. 먹은 아이스크림 종류대로 카운트하기
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
//6. 죠스바와 누가바
int jaws = 0;
int nuga = 0;
for(; ;)
{
Console.Write("어떤 아이스크림(1. 죠스바, 2: 누가바)를 먹을건가요?");
if (icecream == 1)
{
jaws++;
Console.WriteLine("그동안 죠스바를 {0}개 먹었네요\n", jaws);
}
else if(icecream ==2)
{
nuga++;
Console.WriteLine("그동안 누가바를 {0}개 먹었네요\n", nuga);
}
}
|
