5
54
543
5432
54321
int main()
{
int i,j;
for(i=5;i>=1;i--)
{
for(j=1;j<i;j++)
printf(" ");
for(j=5;j>=i;j--)
printf("%d",j);
printf("\n");
}
return 0;
}
Related Links:
- More Number Pattern Programs
- Star Pattern Programs in C
- Alphabet Pattern Programs in C
- Series Programs in C
#include
ReplyDeleteint main()
{
int i,j,k;
for(i=1;i<=5;i++)
{ int k=5;
for(j=5;j>=1;j--)
{
if(j<=i)
printf("%d",k--);
else
printf(" ");
}
printf("\n");
}
return 0;
}
#include
Deleteint main()
{
int i,j,k=1,n;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
k=n;
for(j=n;j>=1;j--)
{
if(j>i)
printf(" ");
else
printf("%d",k--);
}
printf("\n");
}
return 0;
}
#include
ReplyDeleteint main(void)
{
int i, j, k;
for(i = 1; i <= 5; i++)
{
for(j = 1, k = 5; j <= 5; j++)
{
if(k > i)
{
printf("%3c", ' ');
--k;
}
else
{
printf("%3d", j);
}
}
printf("\n");
}
return 0;
}
I want to code
ReplyDeleteOutput aana chahiye
5 4 3 2 1
5 4 3 2
5 4 3
5 4
5