-
-
Save RSquaredSoftware/9339803 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Dylan Turner | |
Take Home Quiz, Chapter 5 | |
March 4th, 2014 | |
*/ | |
#include <iostream> | |
int main() | |
{ | |
// a(1) | |
double a = .3; | |
for (int k = 0; k < 10; k++) | |
{ | |
// temprary variable for the calculated distance | |
double distance = 0; | |
if (k == 0) | |
{ | |
distance = 0.4; | |
} | |
else | |
{ | |
distance = 0.4 + a; | |
a = 2 * a; | |
} | |
std::cout << "Planet: " << k << " Distance: " << distance << std::endl; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment