Sunday, 15 November 2015

C++ Program To Find Cube Using Functions

Problem :- Write A C++ Program To Find Cube Of Any Number Using Functions .

Logic :- Very Simple Just pass the value in Function If you don't know Function You Can see the another Example C Program to Display Prime Numbers Between Intervals Using Using Function

Solution :-

#include<iostream>
using namespace std;

int main()
{
//By-Ghanendra Yadav
                                           
float cube(float);  //Function Type is float
float num,cu;
cout<<"Enter Any Number To Find Cube :\t";
cin>>num;
cu=cube(num);                                    
cout<<"\nCube Of "<<num<<" is = "<<cu<<endl<<endl;
return 0;
}

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

Output:-

C++ Program To Find Cube Using Functions

No comments:
Write comments

Recommended Posts × +