blob: 9294a9dca961f01a191f55b17d8187717b7ee31f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
clc
//
//
//
//Variable declaration
L0=20 //The distance of the star
v=0.95 //velocity
//Calculations
t=L0/v
L=L0*sqrt(1-v**2)
L=(L)
t1=(L*3*10**8)/(v*3*10**8)
//Result
printf("\n (1) The time taken on earth (t) = %0.2f year",t)
printf("\n (2) The time taken on spaceship (t1) = %0.2f year",t1)
|