Navigate back to the homepage

# A Program to display factorial of specified number using for loop in C

Vishnu Damwala,Â
March 1st, 2020 Â· 1 min read

A tutorial to finding factorial for integer data-type using for loop in C - language

#### Working example:

`.css-1chxjt6{position:absolute;right:22px;top:24px;padding:8px 12px 7px;border-radius:5px;color:#6f7177;-webkit-transition:background 0.3s ease;transition:background 0.3s ease;}.css-1chxjt6:hover{background:rgba(255,255,255,0.07);}.css-1chxjt6[data-a11y="true"]:focus::after{content:"";position:absolute;left:-2%;top:-2%;width:104%;height:104%;border:2px solid var(--theme-ui-colors-accent,#6166DC);border-radius:5px;background:rgba(255,255,255,0.01);}@media (max-width:45.9375em){.css-1chxjt6{display:none;}}1/**2 * Factorial For N Using For Loop3 */4#include <stdio.h>5int main()6{7    int i, n, result = 1;8    printf(" Enter number: ");9    scanf("%d", &number);1011    for (i = 1; i <= number; i += 1)12    {13        // printf("\n I : %d", i);14        // printf("\n Result B4 : %d", result);15        result *= i;16        // printf("\n Result After : %d", result);17    }18    printf("\n Factorial of %d : %d", number, result);19    printf("\n");20    return 0;21}`

#### Output for number 5:

`1Enter number: 523Factorial of 5 : 120`

#### Output for number 6:

`1Enter number: 623Factorial of 5 : 720`

### How to find the length of a string using strlen() in C

C program to find length of a string, for e.g, length of "East or West INDIA is best" is 26 (including space and excluding null character).

February 25th, 2020 Â· 1 min read

### Convert hexadecimal color to rgb or rgba in php

Convert hexadecimal color to rgb or rgba in php

February 7th, 2020 Â· 1 min read