Home > Backend Development > C#.Net Tutorial > How to write x raised to the yth power in c program

How to write x raised to the yth power in c program

angryTom
Release: 2020-02-12 17:28:43
Original
10193 people have browsed it

How to write x raised to the yth power in c program

Calculating the nth power of x in C language can be implemented using the library function pow. Function prototype: double pow(double x, double n).

The specific code is as follows:

#include <stdio.h>
#include <math.h>
int main( ) 
{    
    printf("%f",pow(x,n));
    return 0;
}
Copy after login

Note: When using the pow function, the header file #include needs to be included in the source file.

Recommended learning: c language video tutorial

The above is the detailed content of How to write x raised to the yth power in c program. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template