2 solutions

  • 0
    @ 2024-9-6 8:15:17
    #include<stdio.h>
    int main()
    {
    	char ch;
    	scanf("%c",&ch);
    	for(int i=1;i<=3;i++)
    	{
    		for(int j=1;j<=3-i;j++)
    		{
    			printf(" ");
    		}
    		for(int j=1;j<=2*i-1;j++)
    		{
    			printf("%c",ch);
    		}
    		printf("\n");
    	}
    	return 0;
    }
    
    • 0
      @ 2024-2-3 19:58:04

      C++ :

      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
      	char a;							//定义字符变量 a
      	cin>>a;							//输入给定1个字符
      	cout<<"  "<<a<<endl;				//输入一个字符,先输出2个空格
      	cout<<" "<<a<<a<<a<<endl;		//输出3个字符,先输出1个空格
      	cout<<a<<a<<a<<a<<a<<endl;		//输出5个字符
      	return 0;
      }
      
      • 1

      Information

      ID
      34
      Time
      1000ms
      Memory
      128MiB
      Difficulty
      1
      Tags
      # Submissions
      14
      Accepted
      9
      Uploaded By