0% found this document useful (0 votes)
9 views3 pages

Write A C Program To Display A Pattern Like Right Angle Triangle Using Incrementing Numbers

Uploaded by

ytenginkai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views3 pages

Write A C Program To Display A Pattern Like Right Angle Triangle Using Incrementing Numbers

Uploaded by

ytenginkai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Write a C program to display a pattern like right angle triangle using

incrementing numbers.

#include <stdio.h> void main()

int i, j, rows; printf("Input number of rows : ");


scanf("%d", &rows); for (i = 1; i <= rows; i++)

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


printf("\n");

Output:
1
12
123
1234

Write a program in C to make such a pattern like a right angle triangle with
a number which will repeat in a row.
#include <stdio.h>

void main()
{
int i, j, rows;

printf("Input number of rows : ");


scanf("%d", &rows);
for (i = 1; i <= rows; i++)
{
for (j = 1; j <= i; j++)
printf("%d", i);

printf("\n");
}
}

Output:
1
22
333
4444

C program to make such a pattern as a pyramid with an asterisk


#include <stdio.h> // Include the standard
input/output header file.

void main() {
int i, j, spc, rows, k;

printf("Input number of rows : ");


scanf("%d", &rows);
spc = rows + 4 - 1;

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


{
for (k = spc;k >= 1;k--) {
printf(" ");
}

for (j = 1; j <= i; j++) {


printf("* ");
}

printf("\n");
spc—-;
}
}

Output
*
* *
* * *
* * * *

You might also like