View Code of Problem 125

#include<stdio.h> 
int main(){
	int n;
	scanf("%d",&n);
	int m=2*n+3; 
	for(int i=1;i<=m;i++){
		if((i==1)||(i==n+2)||(i==m)){
			for(int j=1;j<=n+2;j++){
				if(j==1)
				printf(" ");
				else if(j==n+2)
				printf(" ");
				else 
				printf("-"); 
			}
		} 
		else{
			for(int j=1;j<=n+2;j++){
				if(j==1)
				printf("|");
				else if(j==n+2)
				printf("|");
				else 
				printf(" "); 
		}
	}
	printf("\n");
}
}


 

Double click to view unformatted code.


Back to problem 125