Part A 1- Write a C program that computes the sum of all odd numbers between two
ID: 642353 • Letter: P
Question
Part A
1- Write a C program that computes the sum of all odd numbers between two given integers N1 and N2 (with N1 < N2) that are divisible by a number N3.
2- The Fibonacci series begins with the terms 0 and 1 and has the property that each succeeding term is the sum of the two preceding terms: 0, 1, 1, 2, 3, 5, 8, 13, 21, etc. Write a C program that calculates the Nth Fibonacci number.
Part B
****please write a comment next to each code explaining what it means!****
Observe the "stick" figure given below that is made of asterisk (*) character:s 1. Write modular and reusable code to print this stick figure Draw another meaningful figure of your choice Algorithm rite an algorithm and include it as a "preamble" comment in your program Code Create a new project called StickFig and add to it a C source file named StickFig.c. Submission Submit the code for StickFig.c (make sure you thoroughly document your program)Explanation / Answer
/*
* C Program to find the nth number in Fibonacci series using recursion
*/
#include <stdio.h>
int fibo(int);
int main()
{
int num;
int result;
printf("Enter the nth number in fibonacci series: ");
scanf("%d", &num);
if (num < 0)
{
printf("Fibonacci of negative number is not possible. ");
}
else
{
result = fibo(num);
printf("The %d number in fibonacci series is %d ", num, result);
}
return 0;
}
int fibo(int num)
{
if (num == 0)
{
return 0;
}
else if (num == 1)
{
return 1;
}
else
{
return(fibo(num - 1) + fibo(num - 2));
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.