3. C Program to find Square and Cube of a given number.
How does this program work?
- In this programme you will learn about how to do Mathematical function using C language.
- This programme will helpful to calculate square and cube of a number.
- And then by using the code below you will get output.
Here is the code
#include <stdio.h>
int main(void)
{
int a, c, d; //Initialise the varibles
printf("Enter A number:\n");
scanf("%d",&a);
c=a*a; // To Square a number
d=a*a*a; //To Cube a number
printf("Square of number %d is = %d \n",a,c);
printf("Cube of Number %d is = %d\n",a,d);
return 0;
}