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

📄 integral_1.cpp

📁 Topics Practices: Programming and Numerical Methods Practice 1: Introduction to C Practice 2
💻 CPP
字号:
#include<stdio.h>
#include<conio.h>
#include<math.h>
float f(float x)
{
      return 3*x*x;
}
float integral(float a, float b, float h)
{
      float x,suma;
      suma=0;
      for(x=a; x<=b; x=x+h)
      suma=suma+h*f(x);
      return suma;   
}
main()
{
      float a,b,h,area;
      printf("Ingrese el extremo izquierdo: ");
      scanf("%f", &a);
      printf("Ingrese el extremo derecho: ");
      scanf("%f", &b);
      for(h=0.1; h>=1e-10; h=h/10)
      {
                  area=integral(a,b,h);
                  printf("Para h= %f el area es: %f \n",h,area);
      }            
      printf("Gracias por utilisar nuestro metodo de integracion \n");
      getch();
}             
                    
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      

⌨️ 快捷键说明

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