This is a example of simple program to find out the square and cube of a number.

This program can be extended to find out any power of a number using recursion function.

//This is a program to find out Square and Cube of a given number

#include<stdio.h>

int main()

{

int num,sqrt,cube;

printf("\nEnter a number to Square and Cube ");

scanf("%d",&num);

sqrt=num*num;

cube=num*num*num;

printf("\nThe Square of the give number is %d\nand the cube of the give number is %d",sqrt,cube);

return 0;

}

This program can be extended to find out any power of a number using recursion function.

//This is a program to find out Square and Cube of a given number

#include<stdio.h>

int main()

{

int num,sqrt,cube;

printf("\nEnter a number to Square and Cube ");

scanf("%d",&num);

sqrt=num*num;

cube=num*num*num;

printf("\nThe Square of the give number is %d\nand the cube of the give number is %d",sqrt,cube);

return 0;

}

## 0 comments:

## Post a Comment