Jump to content

vpatrikv

Members
  • Posts

    2
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

vpatrikv's Achievements

Newbie

Newbie (1/14)

10

Reputation

  1. O varianta poate putin mai simpla : <?php echo '<form action="index.php" method="GET"> Enter number: <input type="text" name="number"> <br/> <input type = "submit" value="Send"> </form>'; if(isset($_GET['number']) && !empty($_GET['number'])){ $number = $_GET['number']; $table =array(); for($i=0;$i<$number;$i++){ for($j=0;$j<$number;$j++){ if(($i == 0) || ($j == 0)){ $table[$i][$j]=1; }else{ $table[$i][$j] = $table[$i-1][$j] + $table[$i][$j-1] + $table[$i-1][$j-1]; } } } echo '<table>'; for($i=$number-1;$i>=0;$i--){ echo '<tr>'; for($j=$number-1;$j>=0;$j--){ echo '<td>'.$table[$i][$j].'</td>'; } echo '</tr>'; } echo '</table>'; } ?>
×
×
  • Create New...