Find factorial using function (non-recursive) Dry Run in C

Find factorial using function (non-recursive) is an interactive C dry run visualizer from the Functions programs section. Study the source code, then use the execution controls to follow each step, variable update, highlighted line, and console output.

This page provides a browser-based dry run with source-code highlighting, auto-scroll, voice narration controls, and execution output for learning the program step by step.

Find factorial using function (non-recursive) Program Code

#include <stdio.h>

long long factorial(int n) {
    long long fact = 1;
    for(int i = 1; i <= n; i++) {
        fact *= i;
    }
    return fact;
}

int main() {
    int num = 5;
    printf("%d! = %lld\n", num, factorial(num));
    return 0;
}

View the complete Functions programs page.

Program Console Find factorial using function (non-recursive) Topic: C Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.