seven characters and width of six and five characters.
Sample output:
######
#
#
#####
#
#
#
Solution:
#include <stdio.h>
int main()
{
printf("######\n");
printf("#\n");
printf("#\n");
printf("#####\n");
printf("#\n");
printf("#\n");
printf("#\n");
return(0);
}
OR
#include<stdio.h>
int main()
{
int row,col;
for(row=7;row>=1;row--){
for(col=1;col<=6;col++){
if(row==7 || col==1)
printf("#");
}
for(col=1;col<=4;col++){
if(row==4)
printf("#");
}
printf("\n");
}
return 0;
}
An alternative way of doing this
ReplyDelete#include
int main(){
int col, row;
for (row = 7; row >= 1; row--)
{
for(col = 1; col <= 5; col++)
{
if(row == 7 || row == 5 || col == 1)
{
printf ("#");
}
}
printf("\n");
}
return 0;
}
Great
ReplyDelete