Header Ads Widget

Ticker

6/recent/ticker-posts

functions program in c :- 1

 Program 1: Implement a program to find cube of any number using function cube having argument list and return type.


#include< stdio.h >

#include< conio.h >

// function prototype, also called function declaration

float cube ( float x );

// main function, program starts from here

void main( )

{

float x, c ;

printf ( "\n Enter any number for finding cube \n");

scanf ( "%f", &x ) ;

// function call

c = cube ( x ) ;

printf ( "\n Cube of the given number %f is %f", x, c );

getch();

}

// function definition

float cube ( float x )

{

float y ;

y = x * x * x;

return ( y ) ;

}




 

Post a Comment

0 Comments