1 comment:

  1. $number=$_POST["num"];
    $choice=(int)$_POST["c"];
    $cH=$_POST["ch"];
    $temp=$number;
    $sum=0;
    echo gettype($choice);
    switch($choice)
    {
    case 1:echo "Reverse a number
    ";
    $reverse=0;
    while($temp>=1)
    {
    $reverse=$reverse*10+$temp%10;
    $temp/=10;
    }
    echo "Reverse of number $number is $reverse";
    break;
    case 2:echo"Sum of all digits
    ";
    while($temp>=1)
    {
    $sum=$temp%10;
    $temp/=10;
    }
    echo "Sum of digits of number $number is $sum";
    break;
    case 3:echo "Number of digits
    ";
    $nodigits=0;
    while($temp>=1)
    {
    $nodigits++;
    $temp/=10;
    }
    echo "Number of digits in $number = $nodigits";
    break;
    case 4:echo "Product of all digit.
    ";
    $product=1;
    while($temp>=1)
    {
    $product*=$temp%10;
    $temp/=10;
    }
    echo "Product of the digits of $number is =$product";
    break;
    case 5:echo "Big digit.
    ";
    $big=$temp%10;
    while($temp>=1)
    {
    if($big<$temp%10)
    $big=$temp%10;
    $temp/=10;
    }
    echo "Biggest digit in $number is $big";
    break;
    case 6:echo "Smallest digit.
    ";
    $small=$temp%10;
    while($temp>=1)
    {
    if($small>$temp%10)
    $small=$temp%10;
    $temp/=10;
    }
    echo "Smallest digit in $number is $small";
    break;

    default: echo"Wrong choice";
    }

    ReplyDelete