[ create a new paste ] login | about

Link: http://codepad.org/TEvtB1hL    [ raw code | output | fork ]

PHP, pasted on Nov 12:
1
2
3
4
5
6
7
8
9
10
<?php
function prob1(){
    $sum1 = 0;
    for($i=0; $i<16; $i++){
        $sum1 = $sum1 + $i; 
    }
    echo "Sum of numbers 1 - 10 is:". $sum1;
}
prob1();
?>


Output:
1
Sum of numbers 1 - 10 is:120


Create a new paste based on this one


Comments: