Write a program which can print the following sequences: Sample Output: 1, 10, 100, 1000, ……, N 1, 3, 6, 10, 15, ……, N
Problem number : 1
Write a program which can print the following sequences:Sample Output:
1, 10, 100, 1000, ……, N
1, 3, 6, 10, 15, ……, N
Solution for this problem :
<?php
//echo "Hello World !";
echo "<br/>";
$a=1;
for($i=0;$i<4;$i++){
echo $a;
echo ", ";
$a=$a*10;
}
echo "...... , N";
echo "<br/>";
echo "<br/>";
$n=1;
for($j= 0; $j < 5; $j++){
$res = $n*($n+1)/2;
echo $res;
$n++;
echo ", ";
}
echo "...... , N";
echo "<br/>";
echo "<br/>";
?>
Sample Output:
1, 10, 100, 1000, ……, N
1, 3, 6, 10, 15, ……, N
1, 10, 100, 1000, ……, N
1, 3, 6, 10, 15, ……, N
মন্তব্যসমূহ
একটি মন্তব্য পোস্ট করুন