You can do this: <?php if ( $word === strrev( $word ) ) { echo "The word is a palindrome"; } else { echo "The word is not a palindrome"; }
Try the triangle program on a search engine. Replace numbers with stars and that should do the trick
< ?php // This is an example of comment in PHP /* This is another example of comment in PHP and we can write comments in multiple lines using this method */ ? >
Code Below: <?php $j = 100; // Set limit upper limit echo "Even Numbers are: <br/>"; for($i=1;$i<=$j;$i++) { if($i%2) { continue; } else { echo $i."<br/>"; } } ?>
To learn PHP it is best to read a few tutorials and then start trying out the things you read about. For instance, make a program that does some calculations and then prints the result on the screen. A good tutorial to start with can be found on: http://w3schools.com/php/default.asp or http://www.geekatude.com/PHP or http://php.net or http://www.phpmysqlbrain.com You can install the things in your local system , and then by referring the above websites try to write codes and see the results.
well, as such there is no Widget in php. You need to write your own widget program if you are interested to develop. You must be aware of wordpress built on php plateform and that uses widget extensively :)
for($rval = $n = intval($_GET['number']); $n > 2; $n--) $rval *= $n - 1;echo $rval;
int factorial(int n) { int i; int f=1; for(i=2;i<=n;++i) f*=i; return f; }
You can do this: <?php if ( $word === strrev( $word ) ) { echo "The word is a palindrome"; } else { echo "The word is not a palindrome"; }
#!/usr/bin/perl print factorial($ARGV[11]); sub factorial { my($num) = @_; if($num == 1) { return 1; # stop at 1, factorial doesn't multiply times zero } else { return $num * factorial($num - 1); # call factorial function recursively } }
Pseudo code+factorial
factorial number Var num= prompt("enter any number "); Var i=1; Var fact=1; for(i=1;i
Ratinonal program in php
int main (void) { puts ("18826771768889260997437677024916008575954036487149242588759823150835\ 31563316135988668829328894959231336464054459300577406301619193413805\ 97818883457558547055524326375565007131770880000000000000000000000000\ 000000"); return 0; }
write a java program to find factorial using recursive and non recursive
Q.1 Write a program to print first ten odd natural numbers. Q.2 Write a program to input a number. Print their table. Q.3 Write a function to print a factorial value.
$n = 10*(1+10)/2;