Se colocaran ejercios para practicar de codigobit
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Factorial.php 1.0 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace App\Commands;
  3. use Illuminate\Console\Scheduling\Schedule;
  4. use LaravelZero\Framework\Commands\Command;
  5. class Factorial extends Command
  6. {
  7. /**
  8. * The signature of the command.
  9. *
  10. * @var string
  11. */
  12. protected $signature = 'factorial';
  13. /**
  14. * The description of the command.
  15. *
  16. * @var string
  17. */
  18. protected $description = 'este comando es para calcular el factorial de un numero';
  19. /**
  20. * Execute the console command.
  21. *
  22. * @return mixed
  23. */
  24. public function handle()
  25. {
  26. $num=10;
  27. $fact=1;
  28. for ($i = $num; $i > 0; $i--)
  29. {
  30. $fact= $fact * $i;
  31. }
  32. echo "El numero factorial es el siguiente = ".$fact;
  33. }
  34. /**
  35. * Define the command's schedule.
  36. *
  37. * @param \Illuminate\Console\Scheduling\Schedule $schedule
  38. * @return void
  39. */
  40. public function schedule(Schedule $schedule): void
  41. {
  42. // $schedule->command(static::class)->everyMinute();
  43. }
  44. }