• Free Template
  • Programming
    • Coding Guides
    • Articles
  • Tips & Tricks
  • Technology
  • What's Hot

c Examples

  • Introduction
  • Hello World
  • Calculation
  • Greatest Number
  • Armstrong Number
  • Multiplication Table
  • Perfect Number
  • Prime Number
  • Even Odd
  • Factorial
  • Fibonacci Series
  • Palindrome Number
  • Palindrome String
  • Temperature Converter
  • Recursive Factorial
  • Numeric Pyramid
  • Decimal to Binary
  • Decimal to Octal
  • Decimal to Hex
  • Binary to Decimal
  • Array Sum
  • Two Array Sum
  • LCM
  • GCD
  • Leap Year
  • Matrix Addition
  • Matrix Multiplication
  • Swapping
  • Binary Search
  • Linear Search
  • Bubble Sort
  • Insertion Sort
  • Selection Sort
  • Quick Sort
  • Merge Sort
  • Heap Sort
  • Write File
  • Read File
  • Copy File
  • Delete File
  • Singly Linked list
  • Doubly Linked list
  • Stack
  • Queue
  • Circular Queue
  • Binary Tree
  • Run Linux Command
  • Change Case

Apr 16, 2020

Factorial

C Programming 588 views
#include<stdio.h>

int main() {

	/* Declaration of Long integer type variables */
	long int no, f = 1;
	printf("Calculate Factorial\n");
	printf("Enter a number:\n");

	/* Received Long integer type number */
	scanf("%ld", &no);
	while(no >= 1) {
		f = no * f;
		no = no - 1;
	}

	/* Print number from a Long integer type variable */
	printf("Factorial: %ld\n", f);
	return 0;
}


/* Output */
Calculate Factorial
Enter a number:
5

Factorial: 120

Factorial

Tags:
cc languagec programmingc coding for factorial numberfactorial number in cgeekboots tutorialgeekboots c programmingc code for factorial number
Author: Geekboots
Share On
Geekboots © 2022 About UsContact UsTermsCookie PolicyPrivacySubmit Article