U E D R , A S I H C RSS

마름모출력/이재경

No older revisions available

No older revisions available



~cpp


#include <stdio.h> 

int main() 
{  
     
    int b,r,a; 
	int n;
	
	printf("홀수인 층수를 입력하시오\n");
	scanf("%d",&n);
       
		for(r=0;r<(n+1)/2;r=r+1){ 
         
			for(b=0;b<(n+1)/2-r;b=b+1){ 
        
            printf(" "); 
			} 
			for(a=n/2;a<n/2+2*r+1;a=a+1){     
            printf("*"); 
             
             
        } 
         
        printf("\n"); 
         
         
    } 
	
		
    for(r=0;r<n/2;r=r+1){ 
             
            for(b=n/2-2;b<n/2+r;b=b+1){ 
                 
                printf(" "); 
            } 
             
            for(a=0;a<n-2*r-2;a=a+1){ 
                 
                printf("*"); 
            } 
             
            printf("\n"); 
             
             
        } 
     	
	
}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:29:24
Processing time 0.0154 sec