Auto-complete Solve the Function 1 Given- 2 F(-1)=-1,F(0) = 0 and F(1) = 1 1 2 !! Sampl 3 #include 4 5 int main 6 int 7 scar 1 8 prir F(N) = F(N-1) + F(N-2) if N>=0 F(N) = F(N+1) + F(N+2) if N 1 + 0 + 1 => 2 2. Example: 1. Input = 5 2. Output = 5 F(5) => F(4) + F(3) => F(3) F(2) + F(2) + F(1) => F(2) + F(1) + F(1) + F(0) + F(1)+F(0)+F(1) => F(1) + F(O) + F(1) + F(1) + F(1) + F(1) => 1 + 0 + 1 + 1 + 1+ 1 => 5
Sample input 3
Sample output 2
Answers
Answered by
0
Answer:
f={(1,1),(2,3),(0,−1),(−1,−3)}
f(x)=ax+b
⇒f(1)=1
⇒a×1+b=1
⇒
⇒f(0)=−1
⇒a×0+b=−1
⇒b=−1
On substituting b=−1 in eqn (1), we get
a+(−1)=1
⇒a=1+1=2
Thus the respective values of a and b are 2 and −1
Answered by
0
Answer:
f={(1,1),(2,3),(0,−1),(−1,−3)}
f(x)=ax+b
⇒f(1)=1
⇒a×1+b=1
⇒
⇒f(0)=−1
⇒a×0+b=−1
⇒b=−1
On substituting b=−1 in eqn (1), we get
a+(−1)=1
⇒a=1+1=2
Thus the respective values of a and b are 2 and −1
Similar questions