i want code for print format as shown below in C lang.

Discussion in 'C' started by dhanesh10, May 31, 2010.

  1. dhanesh10

    dhanesh10 New Member

    Joined:
    May 31, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    *****
    ****
    ***
    **
    *
    what is the code to print such format in C language
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Code:
    printf("*****");
    printf("****");
    printf("***");
    printf("**");
    printf("*");
    This Should do it.
     
  3. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    TMTOWTDI.
    Code:
    void test21()
    {
    	int i=0x3039;
    	do for (int j=0; j<(i%012); j+=printf("*"));
    	while (i/=printf("\n")*012);
    }
    
     
  4. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    And another
    Code:
    void test22()
    {
    	int fudge=20;
    	char *foo=" I am teh 1337 CHEAT";
    	while (fudge--,*foo++)
    		putchar((foo[fudge--]-32)?42:10);
    }
    
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice