473,396 Members | 2,158 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Like fibonacci series

6
Please implement following number series, FiboGorki numbers using a recursive function:

FiboGorki = 1 3 5 9 17 31 57 105 193......

Starting from the 4th element, each element is a summation of previous 3 numbers.



Your function prototype should be:

int FiboGorki(int n)
May 4 '20 #1
2 3427
donbock
2,426 Expert 2GB
Refer the rules regarding posting homework.
May 5 '20 #2
AjayGohil
83 64KB
Hi,

You can try below code:

Expand|Select|Wrap|Line Numbers
  1. #include<stdio.h>    
  2. void FiboGorki(int n){    
  3.     static int n1=1,n2=3,n3=5,n4;    
  4.     if(n>0){    
  5.          n4 = n1 + n2+n3;    
  6.          n1 = n2;    
  7.          n2 = n3;
  8.          n3=n4;    
  9.          printf("%d ",n4);    
  10.          FiboGorki(n-1);    
  11.     }    
  12. }    
  13. int main(){    
  14.     int n;    
  15.     printf("Enter the number of elements: ");    
  16.     scanf("%d",&n);    
  17.     printf("FiboGork Series: ");    
  18.     printf("%d %d%d ",1,3,5);    
  19.     FiboGorki(n-3);//n-3 because 3 numbers are already printed    
  20.   return 0;  
  21.  }  
May 22 '20 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: YS Sze | last post by:
If you know the exact longitude and latitude for a specific location, would anyone think it'd make any sense to find out if this set of location numbers is really part of the Fibonacci series or...
12
by: CII | last post by:
Hi everybody. I've been reading posts a year old about the fibonacci series right on this newsgroup, and while it's not directly games related, I'll share my own notes as well. On another...
22
by: kookai | last post by:
hi I need help with this problem. I have tried writting the program, i just can not get it to run properly. Please Write The Fibonacci series 0, 1, 1, 2, 3, 5, 8, 13, 21, ... begins with the...
4
by: student | last post by:
Hi guys, please tell me how to write the iterative version of fibonacci series using a stack. Thanks
8
by: srinpraveen | last post by:
I know to write a program to print the fibonacci series. But the problem is my teacher has asked us to write a program to print the natural numbers that are not involved in the fibonacci series. For...
2
by: guneet bhatia | last post by:
please help with fibonacci series using recursion..
2
by: rajeshsuri | last post by:
hi this is rajesh please send program for fibonacci series using pointers or functions
10
by: omran11 | last post by:
how to generate fibonacci series (lesser than 100)
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.