please. i really don't know what to do.
i must answer this problem for me to advance in other exercises.

here's the sample problem:

n=4
1234
123
12
1

so far, this is the code that made:
#include<stdio.h>
main()
{
int n,x,y;
clrscr();
printf("n=");
scanf("%d",n);
for (x=1; x<=n; x++)
{
for (y=x; y<=n; y++)
printf("%d",y);
printf("\n");
}
getch();
}

and the sample output of this is:
n=4
1234
234
34
4

:( i'm having a hard time on this one.
thanks in advance for the help.

Try something like this:

printf("n=");
    scanf("%d",&n); /* <--- You should get address here !!! */
    for (x = 1; x <= n; x++)
    {
        for(y = 1; y <= n - x + 1; y++)
            printf("%d",y);
        printf("\n");
    }

it is easy..you can try this too..

#include <stdio.h>
#include<conio.h>

int main()
{
int i,j;
for ( i = 4; i>=0; i-- )
{
for(j=1;j<=i;j++)
printf("%d", j);
printf("\n");
}
return 0;
}

#include<stdio.h>
main()
{
int n,x,y;
clrscr();
printf("n=");
scanf("%d",&n);
for (x=1; x<=n; x++)
{
for (y=x; y<=n; y++)
printf("%d",y);
printf("\n");
}
getch();
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.