Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //1-100 পর্যন্ত যোগ করার প্রোগ্রাম
- <?php
- $sum = 0;
- for ($i=1; $i <=100 ; $i++) {
- $sum += $i;
- }
- echo "Sum from 1-100 is $sum";
- ?>
- //100-1 পর্যন্ত যোগ করার প্রোগ্রাম
- <?php
- $sum = 0;
- for ($i=100; $i >= 1 ; $i--) {
- $sum += $i;
- }
- echo "Sum from 100 to 1 is $sum";
- ?>
- //1-1000 পর্যন্ত জোড় সংখ্যা
- <?php
- for ($i=1; $i <= 1000 ; $i++) {
- if ($i % 2 == 0) {
- echo "$i <br>";
- }
- }
- ?>
- //1-1000 পর্যন্ত বিজোড় সংখ্যা
- <?php
- for ($i=1; $i <= 1000 ; $i++) {
- if ($i % 2 == 0) {
- }else{
- echo "$i<br>";
- }
- }
- ?>
- //factorial number বের করার প্রোগ্রাম
- <?php
- function factNum($n){
- if (!is_numeric($n)) {
- return;
- }
- $factorial = 1;
- if ($n == 0) {
- return $factorial;
- }
- for ($i=$n; $i >= 1 ; $i--) {
- $factorial = $factorial * $i;
- }
- return $factorial;
- }
- $num = 5;
- echo "The factorial number of $num = ". factNum($num);
- ?>
- //Prime number বের করার প্রোগ্রাম
- <?php
- $a = "";
- for ($i=2; $i <=100 ; $i++) {
- $isPrime = true;
- for ($j=2; $j <= $i-1 ; $j++) {
- if ($i % $j == 0) {
- $isPrime = false;
- }
- }
- if ($isPrime == true) {
- echo "$i ";
- $a .= "'$i '";
- }
- }
- echo "<br>The number of Prime numbers from 1-100 is ". str_word_count($a);
- ?>
- //ত্রিভুজের ক্ষেত্রফল বের করার প্রোগ্রাম
- <?php
- $base = 15;
- $height = 37;
- function area_of_triangle($b, $h){
- $area_of_triangle = (1/2)*($b*$h);
- return $area_of_triangle;
- }
- echo "Area with $base meter base and $height meter height =". area_of_triangle($base, $height);
- ?>
- //3 টা সংখ্যার ভিতর বড় সংখ্যা বের করার প্রোগ্রাম
- <?php
- $a = 5;
- $b = 9;
- $c = 3;
- if ($a>$b && $a>$c) {
- echo "The highest number is $a";
- }elseif ($b>$a && $b>$c) {
- echo "The highest number is $b";
- }elseif ($c>$a && $c>$b) {
- echo "The highest number is $c";
- }else{
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement