Program to find cube of entered number using macros

Cube of entered number using macros

Program to find cube of entered number using macros.#define directive is used to specify a macro.

eg. #define blog “www.scanfcode.com”

Program

#include<iostream.h>
#include<conio.h>
#define cube(n)(n*n*n);
void main()
{
clrscr();
int x,y;
cout<<"Enter number to find cube:- ";
cin>>x;
y=cube(x);
cout<<"Cube of number is:- "<<y;
getch();
}

OUTPUT

Cube of entered number using macros


Comment below if you are facing any problem


Also read

C++ Program To Swap 2 Numbers With Third Variable
C++ Program To Find Enter Year Is Leap Year Or Not
C++ Program To Check Input Number Is Even Or Odd
C++ program to find greatest between three numbers using single inheritance
C++ program to find Ascii value of input character or symbol


Leave a Reply

Your email address will not be published. Required fields are marked *