Find the square and cube of a number

Input a number from the user and calculate and print the square and cube of the number.

/*
Calculate Square and Cube of a given Number
Shaswat Saxena
10/11/2017
*/
#include <stdio.h>
#include <conio.h>
#include <math.h>
void main()
  {
  int num,sq,cube;
  clrscr();
  printf("Enter the Number \n");
  scanf("%d",&num);
  //Calculate Square and Cube
  sq=pow(num,2);
  cube=pow(num,3);
  printf("The Square of %d is %d\n",num,sq);
  printf("The Cube of %d is %d\n",num,cube);
  getch();
}

Output

Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Recommended for You  Print the Fibonacci Series

Leave a Reply

Close Menu