Write an efficient Fortran or C program to generate the terms of the series 1 + 1 + 2 + 3 + 5 + 8 + ... and find the sum of first 40 terms.
Answers
Answer:
Hey mate here is your answer...
Input : n = 3
Output : 1 1 2
Input : n = 7
Output : 1 1 2 3 5 8 13
Recommended: Please solve it on “PRACTICE ” first, before moving on to the solution.
C++
// C++ program to print first n Fibonacci numbers
#include <bits/stdc++.h>
using namespace std;
// Function to print first n Fibonacci Numbers
void printFibonacciNumbers(int n)
{
int f1 = 0, f2 = 1, i;
if (n < 1)
return;
for (i = 1; i <= n; i++)
{
cout<<f2<<" ";
int next = f1 + f2;
f1 = f2;
f2 = next;
}
}
// Driver Code
int main()
{
printFibonacciNumbers(7);
return 0;
hope it's helpful for you
follow me ❤️❤️❤️
}
Answer:
Change of Nearest Words
Exercise 02
1. Mohan said to me, "I shall see you tomorrow."
2. He said, "I will do it now."
3. Kuldeep said to me, "I shall wait for you here tomorrow."
4. He said to me, "I saw Mohan yesterday."
5. Madhuri said to me, "I cannot go to school today."
6. He said to his wife, "I saw that blind beggar long ago."
7. They said, "We came home late last night."
plz answer me