Guruh talabasi Abduvohid Ergashev 9-variant Integral hisoblashning trapetsiya usuli


Download 95.46 Kb.
Sana03.12.2020
Hajmi95.46 Kb.
#157887
Bog'liq
6-topshiriq 9


314-18 guruh talabasi Abduvohid Ergashev

9-variant

Integral hisoblashning trapetsiya usuli

Formulasi:



Funksiya : y = sin(x)/2

Dastur kodi:

package integral;

import java.util.Scanner;

public class integral {


public static void main(String[] args) {
System.out.println("y=sin(x)/2 funksiyaning a va b oraliqdagi integralini trapetsiyalar usulida hisoblash: ");
System.out.print("a=");
Scanner in = new Scanner(System.in);
int a = in.nextInt();
System.out.print("b=");
int b = in.nextInt();
integral(a,b);
}
static void integral(int a, int b){
double y;
y = (b-a)*(funksiya(a)+funksiya(b))/2;
System.out.println(String.format("Funksiyaning %d va %d oraliqdagi integrali: \n%f",a,b,y));
}
static double funksiya(int x){
return Math.sin(x)/2;
}
}

Dastur natijasi:




Download 95.46 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling