Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Viết chương trình nhập vào n và in ra hình theo quy luật
- INPUT
- 5
- OUTPUT
- 5 5 5 5 5
- 5 4 4 4 4
- 5 4 3 3 3
- 5 4 3 2 2
- 5 4 3 2 1
- ---------------------------
- #include<stdio.h>
- int main(){
- int n;
- scanf("%d", &n);
- int gt=0;
- for(int i=1;i<=n;i++)
- {
- for(int j=1;j<=n;j++)
- {
- gt++;
- if(j>i) printf("%d ",n-i+1);
- else printf("%d ",n-j+1);
- }
- printf("\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement