#include <iostream>
#include <conio.h>
usingnamespace std;
int main()
{
int usernumber, square, cube;
double sqroot; //sqrt may not be integer value
cout << "Enter any value :" ;
cin >> usernumber;
cout << "x" << "\t" << "sqrt" << "\t" << "x^2" << "\t" << "x^3" << "\n" //displays headers
<< "=============================" << "\n";
for (int i=1;i<=usernumber;i++) //loops from 1 to number input by the user
{
sqroot = sqrt(i); //calculate values
square = i*i;
cube = i*i*i;
cout << i << "\t" << sqroot << "\t" << square << "\t" << cube << "\n"; //display values
}
getch(); //holds screen
return (0);
}
i'm looking to add together the totals of the sqroot, i, square and cube? How would i go about doing this if they're not stored in an array and they are variables?