practica2_11.cpp

来自「Topics Practices: Programming and Nume」· C++ 代码 · 共 34 行

CPP
34
字号
/*PRACTICA 2 EJERCICIO 11
Escribir una funci髇 que tome como par醡etro un n鷐ero entero y que retorne el
factorial de ese n鷐ero. Utilizar la funci髇 en un programa que calcule n鷐eros 
combinatorios.*/

#include<stdio.h>
#include<conio.h>
#include<math.h>
int g(int n)
{
     int producto,x,i;
     producto=1;
     for(i=1;i<=n;++i)
     producto=producto*i;
     return x;
}
main()
{     
      int a,factorial;
      printf("Dame un numero\n");
      scanf("%d",&a);
      factorial=g(a);
      printf("El factorial de ese numero es %d \n\n",g(a));
      printf("PRESIONE CUALQUIER TECLA PARA TERMINAR!!!!");
      getch();
}
      
      
      
      
      
    
    

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?