반응형
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp14
{
class Program
{
static void Main(string[] args)
{
for (int i = 5; i > 0; i--)
{
//Console.WriteLine("*");
for (int j = i; j < 6; j++)
{
Console.Write("*");
}
Console.WriteLine();
}
for (int i = 1; i < 6; i++)
{
for (int j =5; j > i-1; j--)
{
Console.Write("*");
}
Console.WriteLine();
}
for (int i = 5; i > 0; i--)
{
for (int j = i; j < 6; j++)
{
Console.Write("*");
}
Console.WriteLine();
}
for (int i = 5; i > 0; i--)
{
for (int j = 1; j < i +1; j++)
{
Console.Write("*");
}
Console.WriteLine();
}
for (int i = 1; i <6; i++)
{
for (int j = 1; j <=i; j++)
{
Console.Write("*");
}
Console.WriteLine();
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
Console.Write("더하고자 하는 숫자들을 입력하세요 : ");
string s = Console.ReadLine();
Console.WriteLine(s);
//int a = int.Parse(Console.ReadLine());
//int aa = Convert.ToInt32(Console.ReadLine());
int sum = 0;
string[] v = s.Split();
foreach (var item in v)
{
sum = sum + Convert.ToInt32(item);
}
Console.WriteLine(sum);
}
}
}
반응형