online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
/****************************************************************************** Welcome to blackNwhite. Question :- Write a C program to Display Fibonacci sequence . *******************************************************************************/ #include <stdio.h> int main() { int limit, i, first = 0, second = 1, next; // Ask the user to enter the limit for the Fibonacci sequence printf("Enter the limit for the Fibonacci sequence: "); scanf("%d", &limit); // Display the heading for the Fibonacci sequence printf("Fibonacci Sequence up to %d terms:\n", limit); // Generate the Fibonacci sequence using a loop for (i = 0; i < limit; i++) { // Logic to generate the Fibonacci sequence if (i <= 1) next = i; // For the first two terms of the sequence (0 and 1) else { next = first + second; // Generate the next term by adding the previous two terms first = second; // Update the value of the first term second = next; // Update the value of the second term } // Print each term of the sequence printf("%d ", next); } printf("\n"); // Move to the next line after printing the sequence return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue