Program to find Cube in C

Program to find Cube in C Programming

Write a C program to to input any number from user and calculate cube of a number. How to find the cube of a number using C. It’s a basic programming question in which a number is input by a user and this program calculate cube.

#include
#include
void main() 
{
    int number, cube;
 
  printf(" \n Please Enter any integer Value : ");
  scanf("%d", &number);
   /* Cube is calculated. */
  cube = number*number*number;
  
  printf("\n Cube of a given number %d is  =  %d", number, cube);
 
   getch();
}
 

Output

  1. You can see here. First of all the Header File Structure of the C Program has been created.
  2. After that Main() Function is written.
  3. int number, cube These variables have been created. In which the data is stored
  4. cube is also a variable created. Whose value is number*number*number.
  5. printf(“\n Cube of a given number %d is = %d”, number, cube);
TOP