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 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Squares PHP program

    I need help with creating a PHP program with a table that will calculate the following: If anyone can help me get going with this I would greatly appreciate it!:confused

    SQUARES
    ________________________________________

    The square of 1 is 1
    The square of 2 is 4
    The square of 3 is 9
    The square of 4 is 16
    The square of 5 is 25
    The square of 6 is 36
    The square of 7 is 49
    The square of 8 is 64
    The square of 9 is 81
    The square of 10 is 100

    Thanks in advance!

  • #2
    Regular Coder
    Join Date
    Oct 2009
    Location
    United States
    Posts
    157
    Thanks
    8
    Thanked 4 Times in 4 Posts
    You have already asked this question, and it was answered here:

    Help with PHP code
    Adobe Dreamweaver shall be destroyed!

  • #3
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Yes, but it did not work for me!:

  • #4
    Regular Coder
    Join Date
    Oct 2009
    Location
    United States
    Posts
    157
    Thanks
    8
    Thanked 4 Times in 4 Posts
    Then post in that forum what you are doing, what is not working, and what you are trying to do. There is no need making a new topic when you can get the answer in your other post.
    Adobe Dreamweaver shall be destroyed!

  • #5
    Regular Coder
    Join Date
    Jul 2010
    Location
    Oregon City
    Posts
    280
    Thanks
    5
    Thanked 50 Times in 49 Posts
    This will work, sorry about the last thread lol

    PHP Code:
    <?php

    function sq($n) { return $n $n; }

    for(
    $i 1$i<50$i++)
    {
        echo 
    "The square of $i is "$i*$i ."<br />";
        
    }

    ?>

  • #6
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Yes! Thanks so much!


  •  

    Posting Permissions

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