human
Sum of Fibonacci Numbers with alternate negatives | Computes value of first fibonacci numbers and stores their alternate sum.
Initialize result.
Add remaining terms.
For even terms.
For odd terms.
Return the alternating sum.
Driver program to test above function.
Get n.
Find the alternating sum"
Solution in Python:
assistant
#Here is code to sum of Fibonacci Numbers with alternate negatives and the other steps required.
 def calculateAlternateSum ( n ) :
	if ( n <= 0 ) :
		return 0
	fibo = [ 0 ] * ( n + 1 )
	fibo [ 0 ] = 0
	fibo [ 1 ] = 1
	sum = pow ( fibo [ 0 ] , 2 ) + pow ( fibo [ 1 ] , 2 )
	for i in range ( 2 , n + 1 ) :
		fibo [ i ] = fibo [ i - 1 ] + fibo [ i - 2 ]
		if ( i % 2 == 0 ) :
			sum -= fibo [ i ]
		else :
			sum += fibo [ i ]
	return sum
if __name__ == " _ _ main _ _ " :
	n = 8
	print ( " Alternating ▁ Fibonacci ▁ Sum ▁ upto ▁ " , n , " ▁ terms : ▁ " , calculateAlternateSum ( n ) )