Se colocaran ejercios para practicar de codigobit
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

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. }