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 RĂ©ponses
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;
}