Comments

Wednesday, October 17, 2012

Show Array in assending order

Posted by at 8:12 AM Read our previous post


Object

 Write a function which takes an array of 10 elements and sort them in ascending order. Print sorted array from the

calling function.

 

 


Source code

#include <iostream>
using namespace std;

int factorial (int);
int factorial (int num)
{
       int ans=1, fac;
       for(fac=1;fac<=num;fac++)
       {
              ans=ans*fac;
       }
       return(ans);
}
void main(void)
{
       int num , fact,fac;
       cout<<"Enter the number :";
       cin>>num;
       fact=factorial(num);
       cout<<"The factorial of number are:"<<fact<<endl;
       cout<<"The number of Execution:"<<num<<endl;
}

Output

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Popular Posts

Labels

© Codepirate is powered by Blogger - Template designed by Stramaxon - Best SEO Template