« Back to profile of sayedgfx

  • php

    دالة تميز العدد التام من العدد الغير تام

    دالة تميز العدد التام من العدد الغير تام

    21:54 Sep 10 | Tags :
    						function check_fullnum($number) {
    for ($i = 1; $i < $number; $i++) {
        if (is_int(($number / $i))) $result += $i;
    }
    if ($result == $number) echo 'Number '.$number.' is a full number';
    else echo 'Number '.$number.' is not a full number';
}

check_fullnum(6);
// full number     			         
Add comment
To add a comment, please : Login or Sign up
    sayedgfx
    sayedgfx
  • New visitor?

    On setCode, you can save your codes, functions and classes, you can also share them with your friends, and track your favorite developer

    Join the SetCode community
  • Your language here :