A program to display the following series:

                            11,  22,  33,  44 ,  ......,  nn

where n is a number inputted by the user, do not include the header file <math.h>.

 

#include<iostream.h>
#include<conio.h>

void main()
{
clrscr();
int i,j,n,prod;

cout<<"Enter the value of n: ";
cin>>n;
cout<<endl;

for(i=1;i<=n;i++)
{
prod=1;
for(j=1;j<=i;j++)
prod=prod*i;
cout<<prod<<" ";
}

getch();
}

 

< Back