We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 372ccb4 commit 1d6a3baCopy full SHA for 1d6a3ba
trapezoidal_rule.py
@@ -0,0 +1,27 @@
1
+#!/usr/bin/env python3
2
+# -*- coding: utf-8 -*-
3
+"""
4
+Created on Sun Jul 23 15:25:19 2023
5
+
6
+@author: sudipto3331
7
8
9
+def fnc(x):
10
+ return ((x*x))
11
12
+a = float(input("Enter lower limit:"))
13
+b = float(input("Enter upper limit:"))
14
+n = int(input("Enter the number of N:"))
15
16
+area = 0
17
+a_i = a
18
+diff = ((b-a)/n)
19
20
+for i in range (1, n+1):
21
+ b_i = a_i+((diff)*i)
22
+ h = ((b_i-a))
23
+ area = area + (h*((fnc(a)+fnc(b_i))/2))
24
+ a = b_i
25
26
27
+print(area)
0 commit comments