Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Use C++ programming to find Sn = A+AA+AAA+... (of N A), where A is the number ~ ~ A, and N is the keyboard input ~ ~ is shaping.
Use C++ programming to find Sn = A+AA+AAA+... (of N A), where A is the number ~ ~ A, and N is the keyboard input ~ ~ is shaping.
# include & ltiostream & gt

Use namespace std

void main()

{

Cout & lt& lt "Please enter two numbers A and N:";

Double a, s = 0;;

int n;

CIN & gt; & gta & gt& gtn;

for(int I = 1; I < = n; i++)

{

Double t =1.0;

for(int j = 1; j & lt= I; j++)

t = t * a;

s+= t;

}

}