forked from SourceFusionHub/program
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: monicknog <[email protected]>
- Loading branch information
1 parent
5782dc9
commit 183f693
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import Foundation | ||
func calculateCubeVolume(sideLength: Double) -> Double { | ||
let volume = sideLength * sideLength * sideLength | ||
return volume | ||
} | ||
|
||
func main() { | ||
// Input the side length of the cube | ||
let sideLength = 5.0 | ||
|
||
// Calculate the volume of the cube using the function | ||
let volume = calculateCubeVolume(sideLength: sideLength) | ||
|
||
// Print the result | ||
print("The volume of the cube with a side length of \(sideLength) units is \(volume) cubic units.") | ||
} | ||
|
||
// Call the main function to execute the program | ||
main() |