WRITE C++ program to print numbers from 1 to n and also it protect ( i.e, 1*2*....*n)
Answers
Answered by
2
void main()
{
int n,pro=1; #pro for product
cout<<"Enter upto which term you want to print and product: ";
cin>>n
for (int i=1;i<=n;i++)
{
cout<<i<<" ";
pro=pro*i;
}
cout<<"product is: "<<pro;
}
Similar questions