Program to determine the fatorial of a number using while loop.

Using Visual Studio 2015


===============================================================


#include<iostream>
using namespace std;
#include<conio.h>

void main()
{

int n,factorial=1;

cout<<"enter the integer=";

cin>>n;

while (n> 1)

{

factorial*=n--;

}

cout<<"\nFactorial="<<factorial;

_getche();
}



=========================================================================



Comments

Popular posts from this blog

Suppose you are given a square matrix of size n x n, write a program to determine if this is an identity matrix. 2D array

Program to create a multiplication table of a given number using while loop.

Program to find equal values using if statement in C++