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.

4
Contributors
3
Replies
5
Views
7 Years
Discussion Span
Last Post by prvnkmr449

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;
}

Edited by visitor11: n/a

``````#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();
}``````

Edited by prvnkmr449: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.