Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » BeginnersRSS Feeds

Illustration of return of float values

Posted By: Jack Bouchard     Category: C Programming     Views: 3542

Illustration of return of float values.

Code for Illustration of return of float values in C Programming

main( )
{    int x,y;                /*input data */
double power(int, int); /* prototype declaration*/
printf(“Enter x,y:”); scanf(“%d %d” , &x,&y); printf(“%d to power %d is %f\n”, x,y,power (x,y)); } double power (int x, int y); { double p; p = 1.0 ; /* x to power zero */
if(y >=o) while(y--) /* computes positive powers */
p *= x; elsewhile (y++) /* computes negative powers */
p /= x; return(p); } Output Enter x,y:162 16 to power 2 is 256.000000 Enter x,y:16-2 16 to power -2 is 0.003906
  
Share: 


Didn't find what you were looking for? Find more on Illustration of return of float values Or get search suggestion and latest updates.

Jack Bouchard
Jack Bouchard author of Illustration of return of float values is from Montreal, Canada.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!