Problem Description
Consider group of boys are standing in a ground. They should be stand like n*n matrix after giving the value of n.The condition is same color dress weared boys should be in same column.The boys can sit in each row who should be in diagonal.The diagonal can start from end of the first rowTest Case 1
Input (stdin)4
Expected Output432* 43*1 4*21 *321
Test Case 2
Input (stdin)6
Expected Output65432* 6543*1 654*21 65*321 6*4321 *54321
Program
#include <stdio.h> int main() { int i,j,n; scanf("%d",&n); for(i=1;i<=n;i++) { for(j=n;j>=1;j--) { if(i==j) printf("*"); else printf("%d",j); } printf("\n"); } return 0; }
No comments:
Post a Comment
Note: only a member of this blog may post a comment.