Yahoo India Web Search

Search results

    • Half Pyramid of * * * * * * * * * * * * * * * * #include int main() { int i, j, rows; printf("Enter the number of rows: "); scanf("%d", &rows); for (i = 1; i <= rows; ++i) { for (j = 1; j <= i; ++j) { printf("* "); } printf("\n"); } return 0; }
    • Half Pyramid of Numbers. 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5. #include int main() { int i, j, rows; printf("Enter the number of rows: "); scanf("%d", &rows); for (i = 1; i <= rows; ++i) { for (j = 1; j <= i; ++j) { printf("%d ", j); } printf("\n"); } return 0; }
    • Half Pyramid of Alphabets. A B B C C C D D D D E E E E E. #include int main() { int i, j; char input, alphabet = 'A'; printf("Enter an uppercase character you want to print in the last row: "); scanf("%c", &input); for (i = 1; i <= (input - 'A' + 1); ++i) { for (j = 1; j <= i; ++j) { printf("%c ", alphabet); } ++alphabet; printf("\n"); } return 0; }
    • Inverted half pyramid of * * * * * * * * * * * * * * * * #include int main() { int i, j, rows; printf("Enter the number of rows: "); scanf("%d", &rows); for (i = rows; i >= 1; --i) { for (j = 1; j <= i; ++j) { printf("* "); } printf("\n"); } return 0; }
  1. Aug 2, 2022 · Here, we will see how to print a triangle using the C program. Input: 5. Output: * * * * * * * * * * * * * * * Approach: The approach is very simple. We just execute a nested loop, and only print characters when the inner loop is executed after that just change the line. Example:

  2. Aug 2, 2024 · In this article, we will see how to print Pascals triangle in C programming language. Pascal’s Triangle is a triangular array of binomial coefficients in which the nth row contains binomial coefficients nC0, nC1, nC2, ……. nCn.

  3. Jul 10, 2024 · Pascal’s Triangle in C. 1. Right Half Pyramid Pattern in C. The right-half pyramid is nothing but a right-angle triangle whose hypotenuse is in the right direction. We can print the right half pyramid pattern using numbers, alphabets, or any other character like a star (*). Example: C C C.

    • Pattern 2: Half Pyramid Pattern Using Numbers #
    • Pattern 3: Half Pyramid Pattern Using Alphabets #
    • Pattern 6: Full Inverted Pyramid Pattern Using * #
    • Pattern 7: Hollow Right-Angled Triangle Using * #
    • Pattern 8: Inverted Hollow Right-Angled Triangle Using * #
    • Pattern 10: Full Inverted Hollow Pyramid Using * #
    • Pattern 11: Diamond Pattern Using * #

    The following is a C program to print half pyramid pattern using numbers: Try it now Expected Output:

    The following is a C program to print half Pyramid pattern using alphabets: Try it now Expected Output:

    The following is a C program to print full inverted pyramid pattern using *: Try it now Expected Output:

    The following is a C program to print hollow right-angled triangle using *: Try it now Expected Output:

    The following is a C program to print inverted hollow right-angled triangle using *: Try it now Expected Output:

    The following is a C program to print a full hollow inverted pyramid using *: Try it now Expected Output:

    The following is a C program to print a diamond pattern using *: Try it now Expected Output: Recommended Programs: 1. C Program to print Floyd’s Triangle 2. C Program to print Pascal Triangle

  4. Triangle Printing In C - This section will deal to enhance understanding of loops and nested loops. We shall print various pattern to learn how loops in C works.

  5. People also ask

  6. START. Step 1 - Take number of rows to be printed, n. Step 2 - Make outer iteration I for n times to print rows. Step 3 - Make inner iteration for J to (N - 1) Step 4 - Print single blank space " " Step 5 - Close inner loop. Step 6 - Make inner iteration for J to I. Step 7 - Print nCr of I and J. Step 8 - Close inner loop.