Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

sphere volume formula

def volume(radius):
    return (4/3) * math.pi * (radius ** 3) # (4/3)πr^3
Comment

volume of sphere

(4/3)πr^3
Comment

volumeof a sphere

#define _USE_MATH_DEFINES // must include this!
#include <cmath>

return 4/3 * M_PI * r*r*r;
Comment

sphere formula

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func sfa(f float64) float64 {
	return math.Pi * math.Pow(f, 2) * 4
}

func vol(f float64) float64 {
	return math.Pi * math.Pow(f, 3) * math.Pi
}

func dim(f float64) float64 {
	return f * 2
}

func main() {
	s := bufio.NewScanner(os.Stdin)
	fmt.Printf("Enter a sphere's radius: ")
	s.Scan()
	f, _ := strconv.ParseFloat(s.Text(), 64)

	sfaMain := sfa(f)
	volMain := vol(f)
	dimMain := dim(f)

	fmt.Printf("The surfaace area of the sphere: %.3f 
", sfaMain)
	fmt.Printf("The volume of the sphere: %.3f 
", volMain)
	fmt.Printf("The diameter of the sphere: %.3f 
", dimMain)
}
Comment

PREVIOUS NEXT
Code Example
Python :: python serial readline 
Python :: password guessing game python 
Python :: beautifulsoup find text contains 
Python :: python command as an administrator 
Python :: pygame text wrapping 
Python :: python convert string to int 
Python :: binary to string python 
Python :: What is the use of f in python? 
Python :: a string starts with an uppercase python 
Python :: httplib python 
Python :: find element in list that matches a condition 
Python :: discord bot python time delay 
Python :: seaborn plot histogram for all columns 
Python :: python ffmpeg get video fps 
Python :: set value through serializer django 
Python :: remove first element from list 
Python :: install simple audio in python 
Python :: python argument parser default value 
Python :: how to see if a number is prime in python 
Python :: BURGERS2 codechef solution 
Python :: how to convert unicode to string python 
Python :: python abc 
Python :: make a label using tkinter in python 
Python :: pandas show full columns 
Python :: spacy access vocabulary 
Python :: pandas difference between rows in a column 
Python :: print list in one line 
Python :: r named chr to dataframe 
Python :: python for android 
Python :: install apriori package python 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =