In this code,the windows of the house are rectangular.Is there any modification that can be made to change them into diamond shapes.I tried a lot,but the windows came one below the other.
Code:#include<stdio.h> void main() { int i,j,k; for(i=1;i<=10;i++) { for(j=1;j<=10-i;j++) { printf(" "); } for(j=1;j<=i;j++) { printf("="); } for(j=1;j<=50;j++) { if(((i>=3&&i<=8)&&(j>=3&&j<=8))||((i>=5&&i<=6)&& (j>=9&&j<=18))||((i>=3&&i<=8)&&(j>=19&&j<=24))||((i>=3&&i<=4)&&(j>=27&&j<=48))||((i>=5&&i<=6)&&(j>=37&&j<=39))||((i>=7&&i<=8)&&(j>=27&&j<=48))) printf(" "); else printf("="); } for(j=1;j<=i;j++) { printf("="); } printf("\n"); } for(i=1;i<=25;i++) { for(j=1;j<=10;j++) { printf(" "); } for(j=1;j<51;j++) { if(((i>=5&&i<=9)&&(j>=3&&j<=10))||((i>=5&&i<=9)&&(j>=41&&j<=48))||((i>=13&&i<25)&&(j>=20&&j<=31))) printf(" "); else printf("="); } printf("\n"); } }



LinkBack URL
About LinkBacks


