Skip to main content
Commonmark migration
Source Link

#Swift - 85 bytes

Swift - 85 bytes

func y(x:Int,y:Int,z:Int){var m=x,n=y,p=z,c=0;for _ in 1...p{print(m);c=m;m=n;n=c-n}}

Usage: y(x:50,y:40,x:6)

#Swift - 84 bytes

Swift - 84 bytes

func z(l:[Int]){var m=l[0],n=l[1],p=l[2],c=0;for _ in 1...p{print(m);c=m;m=n;n=c-n}}

Usage: z(l: [50,40,6])


Output:

50
40
10
30
-20
50

#Swift - 85 bytes

func y(x:Int,y:Int,z:Int){var m=x,n=y,p=z,c=0;for _ in 1...p{print(m);c=m;m=n;n=c-n}}

Usage: y(x:50,y:40,x:6)

#Swift - 84 bytes

func z(l:[Int]){var m=l[0],n=l[1],p=l[2],c=0;for _ in 1...p{print(m);c=m;m=n;n=c-n}}

Usage: z(l: [50,40,6])


Output:

50
40
10
30
-20
50

Swift - 85 bytes

func y(x:Int,y:Int,z:Int){var m=x,n=y,p=z,c=0;for _ in 1...p{print(m);c=m;m=n;n=c-n}}

Usage: y(x:50,y:40,x:6)

Swift - 84 bytes

func z(l:[Int]){var m=l[0],n=l[1],p=l[2],c=0;for _ in 1...p{print(m);c=m;m=n;n=c-n}}

Usage: z(l: [50,40,6])


Output:

50
40
10
30
-20
50
Source Link
Mr. Xcoder
  • 42.5k
  • 9
  • 81
  • 214

#Swift - 85 bytes

func y(x:Int,y:Int,z:Int){var m=x,n=y,p=z,c=0;for _ in 1...p{print(m);c=m;m=n;n=c-n}}

Usage: y(x:50,y:40,x:6)

#Swift - 84 bytes

func z(l:[Int]){var m=l[0],n=l[1],p=l[2],c=0;for _ in 1...p{print(m);c=m;m=n;n=c-n}}

Usage: z(l: [50,40,6])


Output:

50
40
10
30
-20
50