-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDay-02-Java-Q5
More file actions
46 lines (33 loc) · 986 Bytes
/
Day-02-Java-Q5
File metadata and controls
46 lines (33 loc) · 986 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
43
44
/*kumar wants to know how the math functions are working in programming.could you please help him to write the program.
Input Format
First input corresponds to float is for floor,ceil and round
second input corresponds to integer is for sqrt value
third input corresponds to integer is for base value
fourth input corresponds to integer is for power value
Constraints
No Constraints
Output Format
execute the values depends on the sample output format.
Sample Input 0
67.6734
16
5
2
Sample Output 0
67
68
68
4
25*/
# Answer
import java.util.Scanner;
public class Solution {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
float num = sc.nextFloat();
int sqrtNum = sc.nextInt();
int base = sc.nextInt();
int power = sc.nextInt();
System.out.printf("%d\n%d\n%d\n%d\n%d", (int)Math.floor(num), (int)Math.ceil(num), Math.round(num), (int)Math.sqrt(sqrtNum), (int)Math.pow(base, power));
}
}