Skip to content

Instantly share code, notes, and snippets.

@iamsurya
Created March 1, 2017 14:24
Show Gist options
  • Save iamsurya/708817b8f01a0c1e33dd3d36cb91577e to your computer and use it in GitHub Desktop.
Save iamsurya/708817b8f01a0c1e33dd3d36cb91577e to your computer and use it in GitHub Desktop.
/*
Raju Pengananapuram is a scientist from Chennai working in ISRO. His next project
is to create an algorithm for India's first Mars rover and has three days to do it.
However he also has to attend his brothers wedding in Trivendrum tomorrow.
He sits in his office worried. As he looks outside his window, he comes up with an idea.
He will ask one of his students, Sonik Sharma to help him with this work.
Your task is to calculate the distance the mars rover will travel given a velocity using
the formula distance = time * speed.
Create a program that will ask the user (Raju Pengananapuram) for the velocity of the Mars Rover
in m/s^2.
Store this velocity in a variable. The velocity can be a decimal number.
Once you have the velocity, print a table of results for time = 0.01 to 0.12 seconds.
Example Output:
Hello Mr. Raju Pengananapuram, please enter the velocity for MRover: 231.15
Results for distance calculation for MRover:
Time (seconds) Distance Travelled (metres)
0.01 2.3115
0.02 4.623
0.03 6.9345
0.04 9.246
0.05 11.5575
0.06 13.869
0.07 16.1805
0.08 18.492
0.09 20.8035
0.1 23.115
0.11 25.4265
0.12 27.738
*/
/* #include <iostream> */
/* int main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment