ITP1_5_B: Print a Frame

Structured Program I - Print a Frame

たてH cm よこ W cm の枠を描く問題。


#include <stdio.h>
#include <math.h>


main()
{
int h,w;
while(1){
	scanf("%d %d",&h,&w);
	if((h|w)==0)break;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			printf("%c",j==0||j==w-1||i==0||i==h-1?'#':'.');
		}
		printf("\n");
	}
	printf("\n");
}
}
最終更新:2016年03月19日 09:08