DIGIT-ARC read-only archive · snapshot: July 23, 2026

need c program

4 posts · originally from https://geek.digit.in/community/threads/need-c-program.78840/

VINSTAR
VINSTAR Original post #1
Jan 23, 2008 at 12:49 PM
i need c program for the following questions

Generate the following pattern using nested loops:

1

23

345

4567

56789

678901

7890123

89012345

901234567



Generate the following pyramid of digits using nested loops

. 1
.
. 2 3 2
.
. 3 4 5 4 3
.
. 4 5 6 7 6 5 4
.
. 5 6 7 8 9 8 7 6 5
.
. 6 7 8 9 0 1 0 9 8 7 6
.
. 7 8 9 0 1 2 3 2 1 0 9 8 7
.
. 8 9 0 1 2 3 4 5 4 3 2 1 0 9 8
.
. 9 0 1 2 3 4 5 6 7 6 5 4 3 2 1 0 9
.
. 0 1 2 3 4 5 6 7 8 9 8 7 6 5 4 3 2 1 0
K
khattam_ #2
Jan 23, 2008 at 2:21 PM
Do your Homework yourself dude.. :D
M
Jan 23, 2008 at 7:42 PM
#include<stdio.h>
#include<conio.h>
main()
{int i,j;
for(i=1;i<=10;i++)
{for(j=i;j<=2*i-1;j++)
printf("%d ",j%10);
for(j-=2;j>=i;j--)
printf("%d ",j%10);
printf("\n");
}
getch();
return 0;
}

#include<stdio.h>
#include<conio.h>
main()
{int i,j;
for(i=0;i<9;i++)
{for(j=i+1;j<=2*i+1;j++)
printf("%d ",j%10);
printf("\n");
}
getch();
return 0;
}
//this's for da 1st 1 ... the above 1's 4 da second!.. try doin ur home work yourself!!!
VINSTAR
VINSTAR #4
Jan 30, 2008 at 4:32 PM
thanx ,maddy