-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathformul.java
More file actions
42 lines (23 loc) · 789 Bytes
/
formul.java
File metadata and controls
42 lines (23 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package projeler3;
import java.util.Scanner;
public class formul {
public static void main(String[] args) {
/*
SORU 13 :
KLAVYEDEN GİRİLEN X VE N DEĞERİNE GÖRE;
T = 1 - X/1 + X²/2 + X³/3 + X⁴/4 ...... Xⁿ/N
FORMULUNUN CEVABINI VEREN PROGRAM.
*/
Scanner input = new Scanner(System.in);
System.out.print("x degerini giriniz: ");
double x = input.nextInt();
System.out.print("n degerini giriniz : ");
double n = input.nextInt();
double sonuc = 0, T;
for (double counter = 1; counter <= n; counter++) {
sonuc += (Math.pow(x, counter)) / counter;
}
T = 1 - sonuc;
System.out.println("FORMULUN SONUCU : "+T);
}
}