using System;
using System.Diagnostics.CodeAnalysis;
namespace HelloWorld
{
internal class Program
{
static void Main(string[] args)
{
Console.Write("줄넘기 횟수를 입력 하세요: ");
string num = Console.ReadLine();
int j = Convert.ToInt32(num);
for(int i = 0; i < j; i++)
{
Console.WriteLine("줄넘기를 {0}회 했습니다",i+1);
}
}
}
}
using System;
using System.Diagnostics.CodeAnalysis;
namespace HelloWorld
{
internal class Program
{
static void Main(string[] args)
{
Console.Write("영웅의 공격력 : ");
string satk = Console.ReadLine();
int atk = Convert.ToInt32(satk);
Console.Write("몇회 공격 하시겠습니까?: ");
string stimes = Console.ReadLine();
int times = Convert.ToInt32(stimes);
for(int i = 0; i < times; i++)
{
Console.WriteLine("몬스터를 공격({0})했습니다.", atk);
}
}
}
}
using System;
using System.Diagnostics.CodeAnalysis;
namespace HelloWorld
{
internal class Program
{
static void Main(string[] args)
{
for(int i = 0; i < 6; i++)
{
Console.WriteLine(i+10001);
}
}
}
}
using System;
using System.Diagnostics.CodeAnalysis;
namespace HelloWorld
{
internal class Program
{
static void Main(string[] args)
{
for(int i = 1; i < 6; i++)
{
Console.WriteLine(2*i-1);
}
}
}
}
using System;
using System.Diagnostics.CodeAnalysis;
namespace HelloWorld
{
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("문자를 입력하세요: ");
char word = Convert.ToChar(Console.ReadLine());
int ascii = Convert.ToInt32(word);
for (int i = 0; i < 4; i++)
{
Console.WriteLine("{0}: {1}",(char)(ascii+i),ascii+i);
}
}
}
}
using System;
using System.Diagnostics.CodeAnalysis;
namespace HelloWorld
{
internal class Program
{
static void Main(string[] args)
{
for(int i = 10; i > 0; i--)
{
Console.WriteLine(i);
}
}
}
}
using System;
using System.Diagnostics.CodeAnalysis;
namespace HelloWorld
{
internal class Program
{
static void Main(string[] args)
{
float sum = 0;
float max = 0;
float min = 0;
for (int i = 0; i < 5; i++)
{
Console.Write("키를 입력하세요 (단위 cm) : ");
float num = Convert.ToSingle(Console.ReadLine());
sum += num;
if (num > max)
{
max = num;
}
else
{
min = num;
}
}
Console.WriteLine("평균 : {0}cm, 최대: {1}cm, 최소: {2}cm", sum / 5, max, min);
}
}
}
using System;
using System.Diagnostics.CodeAnalysis;
namespace HelloWorld
{
internal class Program
{
static void Main(string[] args)
{
int uATK = 2;
int uMAXHP = 5;
int uHP = uMAXHP;
int mATK = 3;
int mMAXHP = 5;
int mHP = mMAXHP;
for (int i = 0; mHP > 0; i++)
{
mHP -= uATK;
if (mHP <= 0)
{
mHP = 0;
}
Console.WriteLine("홍길동이 고블린을 공격 했습니다.");
Console.WriteLine("고블린이 피해를({0}) 받았습니다.", uATK);
Console.WriteLine("고블린의 체력은 {0}/{1}입니다.", mHP, mMAXHP);
if (mHP == 0)
{
Console.WriteLine("고블린이 죽었습니다.");
}
Console.WriteLine();
}
}
}
}