- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Java program to find a cube of a given number

Cube of a value is simply three times multiplication of the value with self.

For example, cube of 2 is (2*2*2) = 8.

## Algorithm

- Take integer variable A.
- Multiply A three times.
- Display result as Cube.

## Example

import java.util.Scanner; public class FindingCube { public static void main(String args[]){ int n = 5; System.out.println("Enter a number ::"); Scanner sc = new Scanner(System.in); int num = sc.nextInt(); System.out.println("Cube of the given number is "+(num*num*num)); } }

## Output

Enter a number :: 5 Cube of the given number is 125

- Related Articles
- Java program to find the cube root of a given number
- Java program to find the square root of a given number
- Java program to find the factorial of a given number using recursion
- Python Program to calculate the cube root of the given number
- C++ Program to calculate the cube root of the given number
- Java program to find if the given number is a leap year?
- Java program to print Fibonacci series of a given number.
- Java Program to Find Factorial of a number
- Find the smallest number by which the given number must be divided to obtain a perfect cube also find the cube root of the quotient: $576$.
- Golang Program to find the parity of a given number.
- Prove that if a number is tripled, then its cube is 27times the cube of the given number.
- Write a program in Java to find the missing positive number in a given array of unsorted integers
- C++ Program to Find the Number of Permutations of a Given String
- Java program to count the number of consonants in a given sentence
- Java program to count the number of vowels in a given sentence

Advertisements