public static void main(String[] args) throws IOException {
BufferedReader read = new BufferedReader(new Input StreamReader(System.in));
double r, pi=3.14159;
System.out.println("Please enter radius of sphere:`enter code here` ");
r = Integer.parseInt(read.readLine());
double area=(4/3.0)*pi*(r*r*r);
System.out.println("Area of sphere is : "+area);
}
Asked
Active
Viewed 73 times
-2
Mureinik
- 277,661
- 50
- 283
- 320
Ayaz Muhammad
- 11
- 2
-
3Welcome to StackOverflow! See please: [How do I ask a good question?](http://stackoverflow.com/help/how-to-ask) – Andrii Abramov Jan 07 '17 at 09:58
2 Answers
0
It's O(1) as this will always take the same amount of time.
If your input is insanely long, its complexity is O(n) where n is the number of characters.
jonrsharpe
- 107,083
- 22
- 201
- 376
Peter Lawrey
- 513,304
- 74
- 731
- 1,106
0
The execution time is not affected by the actual input or the size of the data. Therefore, this snippet has an O(1) complexity.
Mureinik
- 277,661
- 50
- 283
- 320