Tuesday, February 17, 2015

C Program to find cube of a number using function

C++ Program to find cube of a number using function

#include<iostream.h>
#include<conio.h>


void main()
{
clrscr();                                                //to clear screen
float cube(float);                                  //function prototype
float a,cu;
cout<<"Enter any number:";
cin>>a;
cu=cube(a);                                         //function calling
cout<<"
Cube of "<<a<<" is "<<cu;

getch();
}


float cube(float a)
{
float cu;
cu=a*a*a;
return(cu);
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.