Repository navigation
Expand file tree
/
Copy pathTaskTwentyseven.java
More file actions
53 lines (40 loc) · 1.72 KB
/
Copy pathTaskTwentyseven.java
File metadata and controls
53 lines (40 loc) · 1.72 KB
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
43
44
45
46
47
48
49
50
51
52
53
import java.util.Scanner;
public class TaskTwentyseven{
public static void main(String[] agrs){
Scanner userInput = new Scanner(System.in);
<<<<<<< HEAD
System.out.print("Enter principal(p): ");
double principal = userInput.nextInt();
System.out.print("Enter annual interest rate: ");
double interest = userInput.nextInt();
System.out.print("Enter time in year: ");
double time = userInput.nextInt();
double interestPercentage = interest / 100;
double simpleInterest = principal * interestPercentage * time;
double simpleInterestResult = simpleInterest/100;
double compoundSquare = (1 + interestPercentage) * (1 + interestPercentage);
double compoundInterest = principal * compoundSquare;
System.out.print("simple Interest: " + simpleInterestResult + "\ncompound Interest " + compoundInterest + "\n");
}
=======
System.out.print("Enter the first an integer: ");
int integerInput = userInput.nextInt();
int divisible1 = integerInput % 2;
int divisible2 = integerInput % 3;
int divisible3 = integerInput % 5;
int divisible4 = integerInput % 7;
if (divisible1 == 0){
System.out.print("it is divisible by 2\n");
}
else if (divisible2 == 0){
System.out.print("it is divisible by 3\n");
}
else if (divisible3 == 0){
System.out.print("it is divisible by 5\n");
}
else if (divisible4 == 0){
System.out.print("it is divisible by 7\n");
}
}
>>>>>>> 23f4b40 (Initial commit)
}