Thread: tringle pyramid

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Oct 2022
    Posts
    96

    tringle pyramid

    I want to print following pyramid

    Code:
        *   
       **
      ***
     ****
    *****
    My code
    Code:
     #include<stdio.h>
    
    int main ()
    {
        int i, j = 0;
        
        for ( i = 0; i < 5; i++)
        {
            for ( j = 0; j < 5; j++)
            {
                printf("*");
            }    
            printf("\n");
        }
        return 0;
    }
    My logic to print pyramid

    i = 0 j = 4
    i = 1 j = 3, j = 4
    i = 2 j = 2 j = 3, j = 4
    i = 3 j = 1, j = 2, j = 3, j = 4
    i = 4 j = 0, j = 1, j = 2 j = 3, j = 4

    I don't understand how to convert logic into code

    any help please
    Last edited by Kittu20; 12-19-2022 at 02:51 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Empty tringle
    By chaklader in forum C Programming
    Replies: 2
    Last Post: 12-11-2010, 07:28 PM
  2. how make this all pyramid in c++ 4.5
    By shah18 in forum C Programming
    Replies: 5
    Last Post: 10-04-2010, 11:34 AM
  3. stupid pyramid
    By nikki19 in forum C++ Programming
    Replies: 4
    Last Post: 12-02-2002, 11:33 PM

Tags for this Thread