Hello, Durga Sadasivuni. Please explain clearly in the Problem Statement what the input (x) represents, and what the output (y) represents. For extra assistance in understanding the problem, you can also provide an example in the Problem Statement. —DIV
Two more issues: (1) You need to decide what value you would like people to use for the speed of light. Depending on the value, you may get non-integer results in the correct output, as per Solution 1559564. If you don't want people to use the exact value, then you must say so [if there is no instruction about the value, then use of the exact value would be implied]. (2) You need to decide what precision you would like the output to be provided in; currently there seem to be rounding errors in your last two test cases [if I understand the problem & your assumptions correctly], as per Solution 1559559. —DIV
The Hitchhiker's Guide to MATLAB
Back to basics 6 - Column Vector
07 - Common functions and indexing 5
MATLAB Basic: rounding III
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office