Become a leader in the IoT community!
Join our community of embedded and IoT practitioners to contribute experience, learn new skills and collaborate with other developers with complementary skillsets.
Join our community of embedded and IoT practitioners to contribute experience, learn new skills and collaborate with other developers with complementary skillsets.
What will be the output of this program when n is 50?
#include <stdio.h>
void fibonacci(int n) {
int a = 0, b = 1, c = 0;
printf("Fibonacci Sequence up to %d:n", n);
while (c <= n) {
printf("%d ", c);
a = b;
b = c;
c = a + b;
}
printf("n");
}
int main() {
int n;
printf("Enter a number: ");
scanf("%d", &n);
fibonacci(n);
return 0;
}
CONTRIBUTE TO THIS THREAD