Skip to content
Logo
  • Home
  • Privacy Policy
  • About Us
  • Disclaimer
  • Terms and Conditions
  • Contact Us

Compute and Display Factorial of Numbers from 1 to n

The following code shows how to Compute and Display Factorial of Numbers from 1 to n.

programmingempire
// Factorial of numbers from 1 to n

#include <stdio.h>

int main()
{
    int n, i,j, f=1;
    printf("Enter the value of n: ");
    scanf("%d", &n);
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=i;j++)
        {
            f*=j;
        }
        printf("Factorial of %d is %d: \n", i, f);
        f=1;
    }

    return 0;
}

Output

Factorial of n Numbers
Factorial of n Numbers

Further Reading

50+ C Programming Interview Questions and Answers

C Program to Find Factorial of a Number

  • AI
  • Android
  • Angular
  • Aptitude Tests
  • ASP.NET
  • Augmented Reality
  • AWS
  • Bioinformatics
  • Biometrics
  • Blockchain
  • Bootstrap
  • C
  • C#
  • C++
  • Claude
  • Cloud Computing
  • Competitions
  • Courses
  • CSS
  • Cyber Security
  • Data Science
  • Data Structures and Algorithms
  • Data Visualization
  • Datafication
  • Deep Learning
  • DevOps
  • Digital Forensic
  • Digital Trust
  • Digital Twins
  • Django
  • Docker
  • Dot Net Framework
  • Drones
  • Elasticsearch
  • ES6
  • Extended Reality
  • Flutter and Dart
  • Full Stack Development
  • Git
  • Go
  • HTML
  • Image Processing
  • IoT
  • IT
  • Java
  • JavaScript
  • Kotlin
  • Latex
  • Machine Learning
  • MEAN Stack
  • MERN Stack
  • Microservices
  • Model Context Protocol (MCP)
  • MongoDB
  • n8n
  • NodeJS
  • PHP
  • Power Bi
  • Projects
  • Python
  • Quantum Computing
  • React
  • Robotics
  • Rust
  • Scratch 3.0
  • Shell Script
  • Smart City
  • Software
  • Solidity
  • Spring Boot
  • SQL
  • SQLite
  • Technology
  • Tkinter
  • TypeScript
  • VB.NET
  • Virtual Reality
  • Web Designing
  • WebAssembly
  • XML
programmingempire
  • Spring Boot 4 REST API with MySQL and Hibernate 7
  • Spring Boot 4 + Hibernate 7 CRUD Application: Step-by-Step Tutorial
  • Spring Framework 7: New Features Developers Should Know in 2026
  • Spring Boot 4 vs Spring Boot 3: What Changed?
  • Spring Boot 4 Tutorial for Beginners: Build Your First Application in 2026

  • AI
  • Android
  • Angular
  • Aptitude Tests
  • ASP.NET
  • Augmented Reality
  • AWS
  • Bioinformatics
  • Biometrics
  • Blockchain
  • Bootstrap
  • C
  • C#
  • C++
  • Claude
  • Cloud Computing
  • Competitions
  • Courses
  • CSS
  • Cyber Security
  • Data Science
  • Data Structures and Algorithms
  • Data Visualization
  • Datafication
  • Deep Learning
  • DevOps
  • Digital Forensic
  • Digital Trust
  • Digital Twins
  • Django
  • Docker
  • Dot Net Framework
  • Drones
  • Elasticsearch
  • ES6
  • Extended Reality
  • Flutter and Dart
  • Full Stack Development
  • Git
  • Go
  • HTML
  • Image Processing
  • IoT
  • IT
  • Java
  • JavaScript
  • Kotlin
  • Latex
  • Machine Learning
  • MEAN Stack
  • MERN Stack
  • Microservices
  • Model Context Protocol (MCP)
  • MongoDB
  • n8n
  • NodeJS
  • PHP
  • Power Bi
  • Projects
  • Python
  • Quantum Computing
  • React
  • Robotics
  • Rust
  • Scratch 3.0
  • Shell Script
  • Smart City
  • Software
  • Solidity
  • Spring Boot
  • SQL
  • SQLite
  • Technology
  • Tkinter
  • TypeScript
  • VB.NET
  • Virtual Reality
  • Web Designing
  • WebAssembly
  • XML
  • Android
  • Angular
  • ASP.NET
  • C
  • C#
  • C++
  • Java
  • JavaScript
  • PHP
  • Python
  • VB.NET
  • Aptitude Tests

Copyright ©2026 Programmingempire . All rights reserved. Powered by WordPress & Designed by Bizberg Themes