Question

Write a C program to print this triangle:

 

              *

               ***

               *****

                *******

                *********

                ************

30 Nov 2017
Answer :
Word Count : 443

To print the given triangle pattern in C, we need to carefully manage the number of spaces and stars for each row. The triangle consists of 6 rows, where the number of stars starts from 1 and increases by 2 stars for each subsequent row. Additionally, the number of leading spaces decreases as the number of stars increases.

Here is a C program to print the triangle pattern:

```c
#include <stdio.h>

int main() {
    int i, j, spaces, stars;
    
    // Loop through the 6 rows
    for(i = 1; i <= 6; i++) {
        // Calculate the number of spaces before the stars
        spaces = 6 - i;
        // Calculate the number of stars in

_______ ________ _________ __________ _________ ____.
_______ _____ ______ _____ ________.
__________ _____ _________ ______ __________ ___ _________ _________ _______ ______ ______.
______ _______ ____ ___ ________ ________ ___ ____ _____ ________ _________ ______.
_____ ____ ______ _______ ___ _________.
_______ _______ ___ ______ ________ _____ ____.
_____ ____ ____ __________ ________ _______ _______ ___ _____ ____ ____ _______.
__________ ______ _________ ______ _____ ________.
__________ ___ __________ ______ ___ _________ __________ _______.
__________ ____ __________ ___ _____ ____.
________ ________ __________ _______ ______ ________ ________.
____ _________ ________ __________ ____ _____ ____ _______ ___.
___ ___ _______ __________ _____ ___.
___ ____ ____ ______ _______ __________ _____ __________.
___ ____ ________ __________ ________ ______ __________ ________.
__________ ______ __________ ______ _____ ____ _____ ____ _________.
____ ____ _______ ___ _____.
_____ ________ ________ _________ ____ ______ _____ _________ _____ ___.
____ ________ __________ _____ _______ ________ ____ _________.
___ _________ ______ _______ ___ _________ ________ ____ _________.
___ __________ _____ _______ _______ _________ ____ ______ __________.
______ ________ ____ _____ ______ _____ ___ _______.
_____ ______ _________ _____ _____.
________ ________ _____ ______ ____ _______ _______ _____ ___ ______ _____ ____.
___ _________ ___ ________ ________ ____ ________ ___ _________ __________ _______ ______.
_____ ______ __________ _________ ___ __________.
________ ______ ___ _____ ____ _______ ________ _____ ____ _______ _____.
_______ ______ ____ ______ ____ ___ ___.
___ ______ ___ ________ _________ ___ ________ ______ _______ _______ ______ _______.
_________ _______ __________ ________ _____ _______ __________.
_____ ___ __________ _________ __________ ______ ____ ________ __________.
__________ ___ _______ ________ ______ __________ _________ ________ _____ ________ _____.
_______ ____ ___ _________ ____ _____ ______ _____ _____ ____ ___.
_____ __________ ____ ______ _______ __________ __________ _______ _____ _________ ___ __________.
______ ______ __________ _______ _________ ____ ______ _________.
_________ ____ ______.
IGNOU ACADEMY
Your IGNOU journey, made easier.
  • Solved Assignments
  • Study Notes
  • Guess Papers
  • Question Papers
Skip in 10
Top
📞
Call Support Instant phone assistance IGNOU MCS 11 2010 - Write a C program to print this triangle:   &nb | IGNOU Academy
→
🟢
WhatsApp Chat Fast live messaging
→
Email Us Business enquiries & support
→