Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Feb 2006
    Posts
    110
    Thanks
    23
    Thanked 0 Times in 0 Posts

    is there any other method to write Hello World?

    have to make a simple program and was wondering if there would be any other better way to have an output like this:


    PHP Code:
                                 H
                         H                     E
           H                        E                        L
    H                    E                    L                         L
    .,................

    and 
    goes on for the next few lines... 
    Code:
    #include<stdio/h>
    main()
    {
    printf(“H\nH     E                   \nH                    E                        L\n”);
    
    }

    do you think there's a better way to have an output instead of using spaces in the code?

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    You can use a tab with \t.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #3
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,853
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Check
    Code:
    #include <stdio.h>
    int main(){
    char a[]="HelloWorld!";
    int i,j,k;
    for(i=0;i<strlen(a);i++){
     for(k=0;k<strlen(a)-i+1;k++)
    	printf("  ") ;
     for(j=0;j<=i; j++)
       printf("%c  ",a[j]);
     printf("\n\n");
    }
    }
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Oh I see now, its supposed to be a triangle :P
    I missed that when I was looking at the original, seemed a little... lopsided lol.

    I demand you change the algorithm to do the christmas tree instead!
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •