⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1erparcial-ejercicio1.cpp

📁 Topics Practices: Programming and Numerical Methods Practice 1: Introduction to C Practice 2
💻 CPP
字号:
/*PRIMER PARCIAL EJERCICIO 1 02/07//
Desarrollo de taylor*/


#include<stdio.h>
#include<conio.h>
#include<math.h>
//Funcion que calcula el Factorial de un numero
int factorial(int x)
{
    int producto,i;
    producto=1;
    for (i=2;i<=x;++i)
    producto=producto*i;
    return producto;
    }
//Funcion que calcula la serie
float serie (float a, float b)
{
      float x;
      int i;
      x=0;
      for(i=0;i<=a;++i)
      {

                       x=x+((pow(b,i)*pow(-1,i))/factorial(i));
      }
      return x;      
      }
main()
{
      float x,t,sol;
      //Ingreso de datos
      printf("Dame el x\n    ");
      scanf("%f",&x);
      printf("Cuantos terminos queres que tenga la serie?\n     ");
      scanf("%f",&t);
      //Calculo de la Serie
      sol=serie(t,x);
      //Muestra por pantalla
      printf("El valor de la funcion EXP[-x] segun su serie de Taylor");
      printf(" con %.0f terminos es:\n\n       %f",t,sol);
      getch();
      }

⌨️ 快捷键说明

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