Have your program print an error message if nlt0 then go


Q ) Write a C program to read in two numbers, x and n, and then compute the sum of this geometric progression.

1+x+x2+x3+....+xn For example: if n is 3 and x is 5, then the program computes 1+5++25+125. Print x,n, the sum Perform error checking. For example, the formula does not make sense for negative exponents - if n is less than 0.

Have your program print an error message if n<0, then go back and read in the next pair of numbers of without computing the sum.

Are any values of x also illegal? If so, test for them too.

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Have your program print an error message if nlt0 then go
Reference No:- TGS01532437

Now Priced at $10 (50% Discount)

Recommended (95%)

Rated (4.7/5)