Sunday 29 March 2015

Calculating factorial of any number in C++

Calculating factorial of any number
#include <iostream>
#include <conio.h>
using namespace std;
int main ()
{
int num;
int factorial=1;
cout<<"enter num";
cin>>num;
for
(int a=1;a<=num;a++)
{
factorial=factorial*a;
}
cout<<"factorial="<<factorial;
getch();
return 0;}
output
enter integer 4
factorial=24

1 comment:

balequast said...

Win on Slots - Live Casino at JTM Hub
Win on slots is the only way to 정읍 출장샵 get closer 춘천 출장안마 to 강릉 출장샵 the excitement you love, with thousands of ways to 성남 출장샵 win every hour and thousands of 광주 출장샵 ways to win every day.