Problem Description
Write a program to generate a following #s triangle:
# # # # #
# # # #
# # #
# #
#Test Case 1
Input (stdin)5
Expected Output##### #### ### ## #
Test Case 2
Input (stdin)7
Expected Output####### ###### ##### #### ### ## #
Program
#include <stdio.h> int main() { int i,j,rows; scanf("%d",&rows); for(i=rows;i>=1;--i) { for(j=1;j<=i;++j) { printf("#"); } printf("\n"); } return 0; }
No comments:
Post a Comment
Note: only a member of this blog may post a comment.