Note : use C languge to do this program , and when you finish convert it to Assi
ID: 3687200 • Letter: N
Question
Note : use C languge to do this program , and when you finish convert it to Assimbley languge. Thanks in advance
Write a program to find and print a Fibonacci sequence of numbers. The Fibonacci seque : nce is defined as follows Fn = Fn-2 + Fn-1, where Fo = 0 and F1-1. Your program should prompt the user to enter a limit, print the sequence up to the limit, and then indicate the greatest power of 2 that the final number printed is divisible by. Assume user input will be between 1 and 4096. Here is what the user will see when the program is executed: This program prints the Fibonacci sequence Enter a limit on the largest number to be displayed: 50 50 is Input 112358 13 21 34 The last number 34 is divisible by 2. Do you want to print a different sequence (Y/N): y y is InputExplanation / Answer
int main(){
int i,range;
long int array[100];
printf("Enter the number range for the series: ");
scanf("%d",&range);
array[0]=0;
array[1]=1;
for(i=2;i<range;i++){
array[i] = array[i-1] + array[i-2];
}
printf("Fibonacci series is: ");
for(i=0;i<range;i++)
printf("%ld ",array[i]);
for(i=1;i<range;i*=2)
{if(((range/(2^i))==0)
printf(“the last number is disible by”+2^i;
}
return 0;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.