+ 1

Pls help to finish this C code

Write a program in C to display the following pattern 100 90 80 70 60 50 40 30 20 10 #include<stdio.h> #include<stdlib.h> int main() { int n=4; int k=100; for(int i=1;i<=n;i++)//for outer loop { for(int j=n;j>=i;j--)//for inner loop { printf("%d\t",k--); } printf("\n"); } }

5th May 2021, 4:51 PM
AvgCoder_03
AvgCoder_03 - avatar
6 Respuestas
+ 2
Show your attempt please
5th May 2021, 5:00 PM
Michal Doruch
+ 2
Just instead of printing k--, print k, and after printf, make k-=10 to decrement it by 10 and you're done k-=10 is the same as k=k-10
5th May 2021, 5:09 PM
Michal Doruch
+ 1
I have attached my attempt above...can u help me
5th May 2021, 5:05 PM
AvgCoder_03
AvgCoder_03 - avatar
+ 1
Thanks a lot! I really appreciate it
5th May 2021, 5:10 PM
AvgCoder_03
AvgCoder_03 - avatar
+ 1
Thanks a lot for ur explanation martin!
5th May 2021, 5:18 PM
AvgCoder_03
AvgCoder_03 - avatar
0
Im sorry,im a noob,how can i decrement k by 10?
5th May 2021, 5:09 PM
AvgCoder_03
AvgCoder_03 - avatar