Friday, July 13, 2012

Pattern English Alphabet X

Write a Program to output this pattern English Alphabet X?

1:  #include<stdio.h>  
2:  int main() {  
3:     int x = 0,y = 5,row,col;  
4:     for(row = 0 ; row < 6 ; row++) {  
5:        for(col = 0 ; col < 6 ; col++) {  
6:          if(col == x || col == y) {  
7:             printf("*");  
8:          }  
9:          else {  
10:             printf(" ");  
11:          }  
12:        }  
13:        x++;  
14:        y--;  
15:        printf("\n");  
16:     }  
17:  }  

Output:-



No comments: