সোমবার, ২৭ এপ্রিল, ২০২০

Write a C program that find the factorial of a given integer number.

Write a C program that find the factorial of a given integer number.




 Problem Name: Write a C program that find the factorial of a given integer number

Algorithm:
Step 01: Start
Step 02: Input Enter an number, n
Step 03: (Initialize) i=1, f=1,
Step 04: Repeat Step 04 through 6 until i=n
Step 05: f=f*i
Step 06: i=i+1
Step 07: Output “Factorial of %d! of=%d”n,f
Step 08: Stop

C Program:
#include<stdio.h>     
int main ()
{
    int i,f=1,n;
                printf("\n\t Enter an number=");
                scanf("%d",&n);
               
                for(i=1;i<=n;i++)
                f=f*i;
                {
                                printf("\n\t Factorial of %d! is=%d",n,f);
                }
    return 0;
}
 

লেবেলসমূহ:

0টি মন্তব্য:

একটি মন্তব্য পোস্ট করুন

এতে সদস্যতা মন্তব্যগুলি পোস্ট করুন [Atom]

<< হোম