백준 프로그래밍
백준 별 찍기 - 1(JAVA, C#)
노마드선샤인
2023. 2. 14. 17:40
728x90
자바
import java.util.*;
public class Main{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
for(int i=1; i<=a; i++)
{
System.out.println("*".repeat(i));
}
}
}
///////////////////
C#
using System;
public class Example
{
public static void Main()
{
String[] s;
Console.Clear();
s = Console.ReadLine().Split(' ');
int n = Int32.Parse(s[0]);
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= i; j++)
{
Console.Write("*");
}
Console.WriteLine();
}
}
}
728x90