Thread: I need to understand this program.

  1. #1
    Registered User
    Join Date
    Nov 2017
    Posts
    22

    I need to understand this program.

    Code:
    #include<stdio.h>
    main()
    {
       int i,j;
       for(i=1;i<=4;i++)
       {
           for(j=1;j<=4-i;j++)
           {
               printf(" ");
           }
           for(j=1;j<=2*i-1;j++)
           {
               printf("*");
           }
           printf("\n");
       }

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Have you tried running it?

    Perhaps go though and rename the lousy variable names with something better, say
    for ( rowNumber = 1;rowNumber <=4;rowNumber ++)
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I can't understand this program
    By tzungshianlin in forum C Programming
    Replies: 2
    Last Post: 12-11-2014, 11:30 PM
  2. Help me understand what the next program does
    By alon4963 in forum C Programming
    Replies: 4
    Last Post: 10-26-2013, 11:26 PM
  3. Can you help me understand this program?
    By SCRIPT_KITTEH in forum C Programming
    Replies: 7
    Last Post: 07-23-2013, 04:03 AM
  4. Help me understand this program
    By DCICJay in forum C Programming
    Replies: 2
    Last Post: 06-06-2011, 08:52 PM
  5. Can someone help me understand this example program
    By Guti14 in forum C Programming
    Replies: 6
    Last Post: 09-06-2004, 12:19 PM

Tags for this Thread