#include <iostream>
using namespace std;
int main()
{
int a,i,j,temp;
int sum;
cout<<"Enter the no:";
cin>>a;
sum=0;
for(i=1;i<=a;i++)
{
temp=1;
for(j=i;j>0;j--)
{
// here logic of n power n
temp=temp*i;
}
//adding a n power n into sum
sum=sum+temp;
}
cout<<"Total sum of series is : ";
cout<<sum<<" ";
return 0;
}
No comments:
Post a Comment