by Dinesh Thakur Category: Functions

 

#include<iostream.h>

#include<conio.h>
void main()
{
      int num, sum=0;
      int fact1,fact2,fact3,fact4,fact5;
      fact1 =fact2=fact3=fact4=fact5=1;
      num=0;
      while(num<=0)
        {
              fact1 =fact1 +fact1 *num;
              num++;
        }
              num=0;
      while (num<=1 )
        {
              fact2 =fact2+fact2*num;
              num++;
        }
              num=0;
     while(num<=2)
       {
              fact3 =fact3+fact3*num;
              num++;
        }
              num=0;
    while(num<=3)
       {
             fact4 =fact4+fact4*num;
             num++;
        }
             num=0;
   while(num<=4)
       {
             fact5 =fact5+fact5*num;
             num++;
       }
             clrscr();
             sum=fact1/1+fact2/2 +fact3/3+ fact4/ 4+fact5/5;
             cout<<"Sum of: 1!/5+ 2!/4+ 3!/3+ 4!/2+ 5!/1 Without Using Function : "<<sum;
             getch();
}

Where! Symbol Indicates Factorial Of Any Number



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Related Articles