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
5 Answers
0
𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 what kind of stuff?
0
𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 it is my first question, that's why i don’t know about it! Please check it, It's okay?
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;
}