- 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
Sum of squares of Fibonacci numbers in C++
Fibonacci series is a mathematical sequence of number which starts from 0 and the sum of two numbers is equal to the next upcoming number, for example, the first number is 0 and the second number is 1 sum of 0 and 1 will be 1
F0=0, F1=1
And
Fn=Fn-1+Fn-2, F2=F0+F1 F2=0+1 F2=1
then when we add number 1 and 1 then the next number will be 2
F1=1, F2=1
And
Fn=Fn-1+Fn-2, F3=F1+F2 F3=1+1 F3=2
Fibonacci sequence is 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, …
We have to find the square of the fuel energy series and then we have to sum it and find the result
Input :4 Output:15 Explanation:0+1+1+4+9=15 forest we will solve Fibonacci numbers till N then we will square them then at them
Example
#include <iostream> using namespace std; int main(){ int n=4, c; int first = 0, second = 1, next; int sum =0; for ( c = 0 ; c < n+1 ; c++ ){ if ( c <= 1 ) next = c; else{ next = first + second; first = second; second = next; } sum+=next*next; } printf("%d",sum ); return 0; }
Output
15
- Related Articles
- Sum of squares of first n natural numbers in C Program?
- Sum of squares of the first n even numbers in C Program
- C++ Program for Sum of squares of first n natural numbers?
- Minimize the sum of squares of sum of N/2 paired formed by N numbers in C++
- Find the Minimum Number of Fibonacci Numbers Whose Sum Is K in C++
- Sum of squares of binomial coefficients in C++
- Python Program for Sum of squares of first n natural numbers
- Difference between sum of the squares of and square of sum first n natural numbers.
- Alternate Fibonacci Numbers in C++
- Large Fibonacci Numbers in C#
- Java Program to calculate Sum of squares of first n natural numbers
- The sum of the squares of two consecutive even numbers is 340. Find the numbers.
- The sum of the squares of three consecutive natural numbers is 149. Find the numbers.
- The sum of the squares of two consecutive odd numbers is 394. Find the numbers.
- Program for Fibonacci numbers in C

Advertisements