#include<iostream>
#include<iomanip>
#include<iostream>
using namespace std;
int product(int k, int i);
int main()
{
int i, k;
cout<<"enter any integer number ";
cin>>k;
for(i=1;i<=10;i++)
cout<<setw(4)<<k<<"*"<<setw(3)<<i<<"="<<setw(4)<<product(k,i)<<endl;
}
//function to evaluate the factorial
int product(int k,int i)
{
if(i==1)
return(k);
else
return(product(k,i-1)+k);
}
#include<iomanip>
#include<iostream>
using namespace std;
int product(int k, int i);
int main()
{
int i, k;
cout<<"enter any integer number ";
cin>>k;
for(i=1;i<=10;i++)
cout<<setw(4)<<k<<"*"<<setw(3)<<i<<"="<<setw(4)<<product(k,i)<<endl;
}
//function to evaluate the factorial
int product(int k,int i)
{
if(i==1)
return(k);
else
return(product(k,i-1)+k);
}
No comments:
Post a Comment