- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Average of Squares of n Natural Numbers?
Given a number n, we need to find the average of the square of natural Numbers till n. For this we will first The squares of all the numbers till n. then we will add all these squares and divide them by the number n.
Input 3 Output 4.666667
Explanation
12 + 22 + 32 = 1 + 4 + 9 = 14 14/3 = 4.666667
Example
#include<iostream> using namespace std; int main() { long n , i, sum=0 ,d; n=3; for(i=1;i<=n;++i) { d=i*i; sum+=d; } cout<<sum/n; return 0; }
- Related Articles
- Average of Squares of Natural Numbers?
- Average of first n even natural numbers?
- Python Program for Sum of squares of first n natural numbers
- C++ Program for Sum of squares of first n natural numbers?
- Sum of squares of first n natural numbers in C Program?
- Java Program to calculate Sum of squares of first n natural numbers
- Find the average of first N natural numbers in C++
- Difference between sum of the squares of and square of sum first n natural numbers.
- PHP program to find the average of the first n natural numbers that are even
- Average of first n odd naturals numbers?
- The sum of the squares of three consecutive natural numbers is 149. Find the numbers.
- 8086 program to determine squares of numbers in an array of n numbers
- 8086 program to find average of n numbers
- Sum of square-sums of first n natural numbers
- How many natural numbers lie between the squares of 25 and 26?

Advertisements