Create a power function for negative exponent using c
C Programming Language / Function in C Language
5229Program:
#include void power(float, float); void main() { float x, n; printf("Enter The value of x and n : "); scanf("%f%f",&x,&n); power(x,n); } void power(float x, float n) { int i; float result = 1; for(i= 0; i
Output:
Enter The value of x and n : 2 2 2.0^-2.0 = 0.250000Press any key to continue . . .
Explanation:
Here in this program no need to put the negative sign of n
This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.
# C Tutorials
# JAVA Tutorials
# HTML Tutorials
# Computer Fundamental
# Data Structure
# DBMS Tutorials
SQL
# C# Language
# R Language
# PHP
# Python
# Vue JS