1.

Write a C++ program for generating the Fibonacci series.

Answer»

The Fibonacci series is a number sequence in which each number is the sum of the previous two numbers. Fibonacci series will have 0 followed by 1 as its first two numbers.

The Fibonacci series is as follows:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55....

The below-given program will display the Fibonacci series of n range of numbers given by the user. If the entered range value is 1, the num1 value will be printed, i.e., 0. If the entered range value is 2, num1 and num2 values will be printed, i.e., 0 and 1. If entered range value is n, num1 and num2 value will be printed. Along with that, each next term will be calculated based on the addition of the previous two numbers and this process continues until it generates n numbers in a Fibonacci series.

#include<iostream.h>#include<conio.h>void main(){ int num1,num2,nextnum,n,i; cout<<"Enter the value for range:"; //Fibonacci series range value will be inputted cin>>n; num1=0; num2=1; cout<<"Fibonacci series is:"<<endl; if(n==1) cout<<num1<<endl; //Single value will be printed if range value is 1 else if(n==2) cout<<num1<<"\t"<<num2<<endl; //Two values will be printed if the range value is two else { cout<<num1<<"\t"<<num2<<"\t"; for(i=3;i<=n;i++) //Fibonacci series will be printed based on range limit { nextnum=num1+num2; cout<<nextnum<<"\t"; num1=num2; num2=nextnum; } } getch();}Conclusion

Accenture is among the leading Fortune 500 companies across the globe with revenue and profits better than most of the MNCs. It is also well-known for its diverse and robust work culture. Obtaining a career at Accenture would help you to upgrade your career growth and knowledge base.

Accenture recruits many candidates EVERY year for their several job opportunities. The candidates should put all their efforts to achieve their goals and the organization should pace up the process to gain more fame in the long run. Recently, Accenture has also ANNOUNCED that it is going to hire PLENTY of candidates across various roles, and hence this is an opportunity to give it your best shot.

Hope this article ASSISTS you to get more information about the Accenture interview process and help you ace through it. We have focused to cover the various aspects like Accenture company profile, Accenture interview questions for freshers/experienced, Accenture HR interview questions, Accenture technical interview questions, here in this article. Now brace yourself for every question thoroughly as this article is going to upgrade your understanding of the Accenture recruitment process.

Useful Resources:

SQL Interview

Java Interview

C++ Interview

Python Interview



Discussion

No Comment Found