Write a program to calculate the factorial of any number using do while loop

Program to calculate the factorial using do while loop

Write a program to calculate the factorial of any number using do while loop

Object: Write a program to calculate the factorial of any number using do while loop.

Code:

#include<iostream>
#include<conio.h>
using namespace std;
void main()
{
int i=1,no,fact=1;
cout<<” Enter Any Number: “;
cin>>no;
do
{
fact=fact*i;
i++;
}while(i<=no);
cout<<“\n Factorial of given Number is: “<<fact;
getch();
}

 

Output:

Write a program to calculate the factorial of any number using do while loop

M.A Siddiqui

Hi, I am M.A Siddiqui. I'm a Computer Science Student, In this website, I'm teaching you Multiple languages and provides Projects and other Subjects Notes.

You may also like...

2 Responses

  1. June 12, 2020

    […] Another Program: Write a program to calculate the factorial of any number using do while loop […]

  2. June 14, 2020

    […] Write a program to calculate the factorial of any number using do while loop […]

Leave a Reply

Your email address will not be published. Required fields are marked *