Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,950 questions

51,892 answers

573 users

How to calculate the volume of a sphere in VB.NET

2 Answers

0 votes
Imports System
 
Public Class CalculateVolumeSphere
	Public Shared Function sphereVolume(r As Double) As Double
 
        Return 4.0 / 3.0 * Math.PI * Math.Pow(r, 3)
 
    End Function
	
    Public Shared Sub Main()
        Dim radius As Integer = 5
         
        Console.Write("Volume of sphere = " & sphereVolume(radius))
    End Sub
End Class


' run:
'
' Volume of sphere = 523.598775598299
'
 
   

 



answered Mar 7, 2018 by avibootz
edited Sep 14, 2024 by avibootz
0 votes
Imports System
 
Public Class CalculateVolumeSphere
    Public Shared Sub Main()
         Dim r As Double = 3
         
        Dim volume As Double = (4 / 3.0) * Math.PI * (r * r * r)
         
        Console.Write("Volume of sphere = " & volume)
    End Sub
End Class


' run:
'
' Volume of sphere = 113.097335529233
'

 



answered Sep 14, 2024 by avibootz

Related questions

1 answer 193 views
1 answer 80 views
1 answer 88 views
1 answer 90 views
1 answer 144 views
1 answer 125 views
1 answer 123 views
...