Fibonacci Series in 1-Line PHP / Java Software 피보나치 시리즈에서 1 - 라인 php / 자바 소프트웨어
No, I am not competing for obfuscated code context. 아니오, 난 아무것도 읽을 수없는 코드를 컨텍스트 경쟁을합니다. I realized while showing it to someone that Fibonacci series can be written much more succintly using modern programming languages like c, java or php. 나는 그것을 실현있는 그런 사람을 표시하는 동안 피보 시리즈로 작성할 수있습니다 훨씬 더 현대적인 프로그래밍 언어를 사용하여 같은 succintly c, 자바 또는 php.
Here is the one-line php version: 다음은 한 - 라인 php 버전 :
' ?> '?>
It outputs 100 fibonacci numbers, each in separate line. 그것 출력 100 피보나치 숫자, 각각을 별도의 라인.
Note: It doesn’t use a temporary variable as is normal in other implementations. 참고 사항 : 임시 변수를 사용하지 않는 그것은 정상적인 다른 구현합니다. It obviates the need by utilizing the power of expressions. 그것 obviates의 전원을 활용하여 표현이 필요합니다. The rest is achieved with a simple for loop. 나머지는 단순 루프를 달성합니다.
Here is the same example in Java / JSP. 여기서는 같은 예제에 자바 / jsp합니다.
<% for(double current = 1, last = 0, i = 1;i++ <= 100;) out.println((current = last + (last = current)) + " <%의 (더블 전류 = 1, 마지막으로 = 0, 나 = 1; 나는 + + <= 100;) out.println ((전류 = 지난해 + (지난 = 현재)) + "
"); %> ");"%>
Note: The double is used because long is unable to display correctly all 100 numbers due to size limitations. 참고 :이 두 번가 사용됩니다 정확하게 때문에 시간은 모두 100 번호를 표시할 수없습니다 크기 제한으로 인해합니다.
Filed under 밑에 Headline News 헤드 라인 뉴스 , Java Software 자바 소프트웨어 , PHP php , Tech Note 기술 참고 사항 | |
| |
RSS 2.0 rss 2.0 | |
Trackback 트랙백 this Article | 이 문서 |
Email this Article 전자 우편이 문서
You may also like to read 같은를 읽을 수있습니다 |




May 24th, 2006 at 12:32 am 2006년 5월 24일에서 오전 12시 32분
all the viruses are not dangerous some are operating systems 모든 바이러스는 운영 체제에 위험하지 않다는 일부는
May 27th, 2006 at 6:40 am 2006년 5월 27일에서 오전 6시 40분
How is it relevant in context? 맥락에서 관련성이 높은 방법은?
October 4th, 2006 at 2:12 am 2006년 10월 4일에서 오전 2시 12분
Your php fubonacci script does not work mate 귀하의 php fubonacci 스크립트가 작동하지 않습니다 메이트
October 4th, 2006 at 5:34 am 2006년 10월 4일에서 오전 5시 34분
Single quotes 작은 따옴표 problem mate. 문제가 메이트합니다. It now works fine. 이제 제대로 작동합니다.
February 12th, 2008 at 8:12 am 2008년 2월 12일에서 오전 8시 12분
That is not the fibonacci sequence.. 피보나치 수열이 아닌 ..
June 19th, 2008 at 6:40 am 2008년 6월 19일에서 오전 6시 40분
does anyone know the fibonacci code for this output? 이 출력 피보나치 코드를 누구 아시는 분 있나요?
0 1 1 2 3 5 8 0 1 1 2 3 5 8
i only know this part $limit=7 =( help 단지 내가 아는이 부분은 $ 한도 = 7 = (도움말