Thursday 16 July 2020

POW function | C Language

Q : Write a function fnpow() in C to compute xy where x is float and y is integer. Function will return the result and takes x, y as arguments.

Answer :

#include<stdio.h>
#include<conio.h>
/*============================
     Girfa Student Help
     User defined pow function
==============================*/

float fnpow(float,int);
void main()
{
     float x;
     int y;
     clrscr();
     printf("Enter value of X >> ");
     scanf("%f",&x);
     printf("Enter value of y >> ");
     scanf("%d",&y);
     printf("pow of xy is %f",fnpow(x,y));
     getch();
}
float fnpow(float x,int y)
{
     return x*y;

}

No comments:

Post a Comment