C Program to find square and cube of given number

Problem Statement

You need to write a program in C to find the square and cube of a given number.

Solution

#include<stdio.h>
int main()
{
int n;
printf("Enter a number");
scanf("%d",&n);
printf("\nSquare of the number %d is %d",n,n*n);
printf("\nCube of the number %d is %d",n,n*n*n);
return 0;
}

Leave Your Comment