- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# PHP program to find the sum of the 5th powers of first n natural numbers

To find the sum of the 5th powers of first n natural numbers, the code is as follows −

## Example

<?php function sum_of_fifth_pow($val) { $init_sum = 0; for ($i = 1; $i <= $val; $i++) $init_sum = $init_sum + ($i * $i * $i * $i * $i); return $init_sum; } $val = 89; print_r("The sum of fifth powers of the first n natural numbers is "); echo(sum_of_fifth_pow($val)); ?>

## Output

The sum of fifth powers of the first n natural numbers is 85648386825

A function named ‘sum_of_fifth_pow’ is defined, and an initial sum value is defined as 0. The fifth power of every natural number up to a certain range is computed and added to the initial sum value. Outside the function, a value is defined and the function is called by passing this value as parameter. Relevant message is displayed on the console.

- Related Questions & Answers
- PHP program to find the sum of cubes of the first n natural numbers
- 8085 program to find the sum of first n natural numbers
- PHP program to calculate the sum of square of first n natural numbers
- PHP program to find the sum of the first n natural numbers who are not powers of a specific number ‘k’
- Program to find sum of first n natural numbers in C++
- Java program to find the sum of n natural numbers
- C Program for the cube sum of first n natural numbers?
- PHP program to find the average of the first n natural numbers that are even
- Sum of first n natural numbers in C Program
- Java Program to cube sum of first n natural numbers
- Sum of sum of first n natural numbers in C++
- C++ Program for Sum of squares of first n natural numbers?
- Sum of squares of first n natural numbers in C Program?
- Python Program for Sum of squares of first n natural numbers
- C Program for cube sum of first n natural numbers?

Advertisements