ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 2439번, 2440번, 2441번
    백준알고리즘/입출력 2020. 10. 2. 15:43

    2439번

    #include<iostream>
    using namespace std;
    
    int main()
    {
    	int n = 0;
    	cin >> n;
    	for (int j = 0; j < n; j++)
    	{
    		for (int i = n - j; i > 1; i--)
    		{
    			cout << ' ';
    
    		}
    		for (int i = 0; i <= j; i++)
    		{
    			cout << '*';
    		}
    		cout << '\n';
    	}
    	
    }

     

    2440번

    #include<iostream>
    using namespace std;
    
    int main()
    {
    	int n = 0;
    	cin >> n;
    	for (int i = 0; i < n; i++)
    	{
    		for (int j = n - i; j > 0; j--)
    		{
    			cout << '*';
    		}
    		cout << '\n';
    	}
    }

     

    2441번

    #include<iostream>
    using namespace std;
    
    int main()
    {
    	int n = 0;
    	cin >> n;
    	for (int i = 0; i < n; i++)
    	{
    		for (int j = 0; j < i; j++)
    		{
    			cout << ' ';
    		}
    		for (int j = n - i; j > 0; j--)
    		{
    			cout << '*';
    		}
    		
    		cout << '\n';
    	}
    }

    '백준알고리즘 > 입출력' 카테고리의 다른 글

    2446번  (0) 2020.10.02
    2442번, 2445번  (0) 2020.10.02
    8393번, 10818번, 2438번  (0) 2020.10.02
    1924번  (0) 2020.10.02
    11721번,2741번,2742번,2739번  (0) 2020.10.02
Designed by Tistory.