View Code of Problem 125

#include<stdio.h>
int main(){
	int n;
	int ct=0;
	scanf("%d",&n);
    char a[1000][1000];
	int l=2*n+3;
	for(int i=0;i<l;i++){
		for(int j=0;j<n+2;j++){
			if((ct%(n+1))==0){
			  a[i][j]='-';
			  a[ct][0]=' ';
			  a[ct][n+1]=' ';
		}
			else if(j==0||j==n+1){
				a[i][j]='|';
			}
			else{
				a[i][j]=' ';
			}
		}
		ct++;
	}
	for(int k=0;k<l;k++){
		for(int z=0;z<n+2;z++){
			printf("%c",a[k][z]);
		}
		printf("\n");
	}
}

Double click to view unformatted code.


Back to problem 125