C++
// CPP program to calculate Volume and
// Surface area of frustum of cone
#include <iostream>
using namespace std;
float pi = 3.14159;
// Function to calculate Volume of frustum of cone
float volume(float r, float R, float h)
{
    return (float(1) / float(3)) * pi * h *
                    (r * r + R * R + r * R);
}
// Function to calculate Curved Surface area of
// frustum of cone
float curved_surface_area(float r, float R, float l)
{
    return pi * l * (R + r);
}
// Function to calculate Total Surface area of 
// frustum of cone
float total_surface_area(float r, float R, float l, 
                                           float h)
{
    return pi * l * (R + r) + pi * (r * r + R * R);
}
// Driver function
int main()
{
    float small_radius = 3;
    float big_radius = 8;
    float slant_height = 13;
    float height = 12;
    // Printing value of volume and surface area
    cout << "Volume Of Frustum of Cone : "
         << volume(small_radius, big_radius, height) 
         << endl;
    cout << "Curved Surface Area Of Frustum of Cone : "
         << curved_surface_area(small_radius, big_radius, 
                                 slant_height) << endl;
    cout << "Total Surface Area Of Frustum of Cone : "
         << total_surface_area(small_radius, big_radius, 
                                 slant_height, height);
    return 0;
}
Java
// Java program to calculate Volume and Surface area
// of frustum of cone
public class demo {
    static float pi = 3.14159f;
    // Function to calculate Volume of frustum of cone
    public static float volume(float r, float R, float h)
    {
        return (float)1 / 3 * pi * h * (r * r + R * R +
                                                r * R);
    }
    // Function to calculate Curved Surface area of
    // frustum of cone
    public static float curved_surface_area(float r, 
                                   float R, float l)
    {
        return pi * l * (R + r);
    }
    // Function to calculate Total Surface area of 
    // frustum of cone
    public static float total_surface_area(float r, 
                         float R, float l, float h)
    {
        return pi * l * (R + r) + pi * (r * r + R * R);
    }
    // Driver function
    public static void main(String args[])
    {
        float small_radius = 3;
        float big_radius = 8;
        float slant_height = 13;
        float height = 12;
    // Printing value of volume and surface area
        System.out.print("Volume Of Frustum of Cone : ");
        System.out.println(volume(small_radius, 
                            big_radius, height));
        System.out.print("Curved Surface Area Of" + 
                            " Frustum of Cone : ");
        System.out.println(curved_surface_area(small_radius,
                                  big_radius, slant_height));
        System.out.print("Total Surface Area Of" + 
                " Frustum of Cone : ");
        System.out.println(total_surface_area(small_radius, 
                        big_radius, slant_height, height));
    }
}
C#
// C# program to calculate Volume and 
// Surface area of frustum of cone
using System;
public class demo {
    static float pi = 3.14159f;
    // Function to calculate 
    // Volume of frustum of cone
    public static float volume(float r, float R, float h)
    {
        return (float)1 / 3 * pi * h * (r * r + R * 
                                        R + r * R);
    }
    // Function to calculate Curved
    // Surface area of frustum of cone
    public static float curved_surface_area(float r, 
                                float R, float l)
    {
        return pi * l * (R + r);
    }
    // Function to calculate Total
    // Surface area of frustum of cone
    public static float total_surface_area(float r, float R, 
                                           float l, float h)
    {
        return pi * l * (R + r) + pi *
                    (r * r + R * R);
    }
    // Driver function
    public static void Main()
    {
        float small_radius = 3;
        float big_radius = 8;
        float slant_height = 13;
        float height = 12;
    // Printing value of volume 
    // and surface area
    Console.Write("Volume Of Frustum of Cone : ");
    
    Console.WriteLine(volume(small_radius, 
                    big_radius, height));
    Console.Write("Curved Surface Area Of" + 
                     " Frustum of Cone : ");
                     
    Console.WriteLine(curved_surface_area(small_radius,
                            big_radius, slant_height));
                            
    Console.Write("Total Surface Area Of" + 
                    " Frustum of Cone : ");
    Console.WriteLine(total_surface_area(small_radius, 
                    big_radius, slant_height, height));
    }
}
// This article is contributed by vt_m
JavaScript// Function to calculate Volume of frustum of cone
function volume(r, R, h) {
    const pi = 3.14159;
    return (1 / 3) * pi * h * (r * r + R * R + r * R);
}
// Function to calculate Curved Surface area of frustum of cone
function curvedSurfaceArea(r, R, l) {
    const pi = 3.14159;
    return pi * l * (R + r);
}
// Function to calculate Total Surface area of frustum of cone
function totalSurfaceArea(r, R, l, h) {
    const pi = 3.14159;
    return pi * l * (R + r) + pi * (r * r + R * R);
}
// Driver function
function main() {
    const smallRadius = 3;
    const bigRadius = 8;
    const slantHeight = 13;
    const height = 12;
    // Printing value of volume and surface area
    console.log("Volume Of Frustum of Cone : " + volume(smallRadius, bigRadius, height));
    console.log("Curved Surface Area Of Frustum of Cone : " + curvedSurfaceArea(smallRadius, bigRadius, slantHeight));
    console.log("Total Surface Area Of Frustum of Cone : " + totalSurfaceArea(smallRadius, bigRadius, slantHeight, height));
}
// Calling the main function
main();
PHP
<?php
// PHP program to calculate Volume and
// Surface area of frustum of cone
// Function to calculate 
// Volume of frustum of cone
function volume($r, $R, $h)
{
    $pi = 3.14159;
    return (1 / (3)) * $pi * $h *
           ($r * $r + $R * $R + $r * $R);
}
// Function to calculate Curved 
// Surface area of frustum of cone
function curved_surface_area($r, $R, $l)
{
    $pi = 3.14159;
    return $pi * $l * ($R + $r);
}
// Function to calculate Total Surface 
// area of  frustum of cone
function total_surface_area( $r, $R, $l, $h)
{
    $pi = 3.14159;
    return ($pi * $l * ($R + $r) + 
            $pi * ($r * $r + $R * $R));
}
    // Driver Code
    $small_radius = 3;
    $big_radius = 8;
    $slant_height = 13;
    $height = 12;
    // Printing value of volume 
    // and surface area
    echo("Volume Of Frustum of Cone : ");
    echo(volume($small_radius, 
                $big_radius, 
                $height)); 
    echo("\n");
    echo("Curved Surface Area Of Frustum of Cone : ");
    echo (curved_surface_area($small_radius, 
                              $big_radius ,
                              $slant_height));
    echo("\n");
    echo("Total Surface Area Of Frustum of Cone : ");
    echo(total_surface_area($small_radius, 
                            $big_radius, 
                            $slant_height, 
                            $height));
    
// This code is contributed by vt_m
?>
Python3
# Python3 code to calculate 
# Volume and Surface area of
# frustum of cone
import math
pi = math.pi
# Function to calculate Volume
# of frustum of cone
def volume( r , R , h ):
    return 1 /3 * pi * h * (r 
            * r + R * R + r * R)
# Function to calculate Curved 
# Surface area of frustum of cone
def curved_surface_area( r , R , l ):
    return pi * l * (R + r)
# Function to calculate Total  
# Surface area of frustum of cone
def total_surface_area( r , R , l , h ):
    return pi * l * (R + r) + pi * (r
                            * r + R * R)
    
# Driver Code
small_radius = 3
big_radius = 8
slant_height = 13
height = 12
# Printing value of volume 
# and surface area
print("Volume Of Frustum of Cone : "
                                ,end='')
print(volume(small_radius, big_radius,
                                height))
print("Curved Surface Area Of Frustum"+
                    " of Cone : ",end='')
print(curved_surface_area(small_radius,
                big_radius,slant_height))
print("Total Surface Area Of Frustum"+
                    " of Cone : ",end='')
print(total_surface_area(small_radius, 
        big_radius,slant_height, height))
# This code is contributed by "Sharad_Bhardwaj".