Could anyone help me with the simplest way of coding a triangle..
starting with a 1, and a 123 underneath that and a 12345 underneath that and 1234567 "" "" and then ending with 123456789 underneath that..
Printable View
Could anyone help me with the simplest way of coding a triangle..
starting with a 1, and a 123 underneath that and a 12345 underneath that and 1234567 "" "" and then ending with 123456789 underneath that..
Do you want a triangle like:
orCode:1
123
12345
1234567
123456789
For the first one try this:Code:1
123
12345
1234567
123456789
Code:
main()
{
int i,c;
for(i=1;i<=9;i+=2)
{
for(c=1;c<=i;c++)
{
printf("%d",c);
}
printf("\n");
}
}