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 90 times
        
    -2
            
            
         
    
    
        Mureinik
        
- 297,002
- 52
- 306
- 350
 
    
    
        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
        
- 115,751
- 26
- 228
- 437
 
    
    
        Peter Lawrey
        
- 525,659
- 79
- 751
- 1,130
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
        
- 297,002
- 52
- 306
- 350