How can i write following triangle pattern in C language? #newbie | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can i write following triangle pattern in C language? #newbie

Input: 10 Output: 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5

22nd May 2020, 7:42 AM
Asad al aziz(아사드)
Asad al aziz(아사드) - avatar
3 Answers
22nd May 2020, 1:17 PM
Asad al aziz(아사드)
Asad al aziz(아사드) - avatar
0
𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 it is my first question, that's why i don’t know about it! Please check it, It's okay?
22nd May 2020, 1:27 PM
Asad al aziz(아사드)
Asad al aziz(아사드) - avatar
0
I already wrote the code! #include<stdio.h> int main() { int n,j,k,i,c=1; scanf("%d",&n); for(i=1;i<=n;i++) { for(k=1;k<=n-i;k++) { printf (" "); } for(j=1;j<=i;++j) { if(c==10) { c=0; } printf ("%d ",c); ++c; //printf ("* "); } printf ("\n"); } return 0; }
22nd May 2020, 1:33 PM
Asad al aziz(아사드)
Asad al aziz(아사드) - avatar