viernes, 21 de octubre de 2011

obtener el factorial ingresado por teclado en C#

#include <stdio.h>

int main()
          {
           int num;
           int i = 1;
           int factor = 1;
           printf("Introduce un numero para ver su factorial\n");
           scanf("%d", &num);
           if (num < 0)
              {
              printf("No has introducido un numero valido\n");
              getch();
              }
              else {
                   while (num > 0) {
                   factor = num * factor;
                   num--;
                   }
              }
              printf("El factorial es %d\n", factor);
              getch();
              return 0 ;
           }

1 comentario:

  1. How to hack youtube: best how to hack youtube - Videoodl.cc
    youtube is a powerful way to find and archive YouTube videos, and this allows you youtube mp3 to have access to the latest videos that YouTube is famous for.

    ResponderEliminar