## Trending News

Promoted

Anonymous

# answer the following programming?

Please write the code for the following program in C:

sample input :4

Sample output :

1

1 2

1 2 3

1 2 3 4

### 3 Answers

Relevance

- brilliant_movesLv 78 years agoFavorite Answer
The algorithm is:

get number n

for i is 1 to n

for j is 1 to i

print j + a space

next j

print newline

next i

Source(s): Experience - James BondLv 78 years ago
int i, j, n;

printf("Enter an integer\n");

for(i=1;i<=n;i++)

{

for(j=1;j<=i;j++) printf("%d",j);

printf("\n");

}

Still have questions? Get your answers by asking now.