올린글을 확인할 수 있도록 포스팅을
공개
로 설정해 주세요.
포인트는 운영자가 올린글을 검토후 지급됩니다. 검토요청이 누적된 상황에서는 포인트 지급에 상당한 지연이 발생할 수 있습니다.
[레포트] 부산대학교 정보컴퓨터공학전공 과제 Imperative VS Applicative program
2008-061
프로그래밍언어론 과제#1
정보컴퓨터공학전공 부산대학교
2008년 3월 21일
1. 1.5
문제 - Imperative VS Applicative programs
1.1 Imperative Version
1) Source Code
#include [stdio.h]
#include [stdlib.h]
void print(double value){
printf(%.5f
,value)
}
double fib(int n){// [1]
int index
double last1, last2, result
if(n[=2){
return 1
}
last1 =1
last2 =1
for(index=2 index[n index++){
result = last1 + last2
last2 = last1
last1 = result
}
return result
}
void toLimit(int start){
if((int)(fib(start+1)*100000/fib(start))!= (int)(fib(start+2)*100000/fib(start+1))){
print(fib(start+1)/fib(start))
}else{
printf(Limitation reached
)
exit(0)
}
}
int main(){
int i
for(i=1i[999 i++){
toLimit(i)
}
return 0
}
2) 결과
소수점 아래 5자리 까지 검사하여 다음에 나올 수와 같기 때문에 1.61803에서 멈추었다.
3) 검토
....
[hwp/pdf][레포트] 부산대학교 정보컴퓨터공학전공 과제 Imperative VS Applicative program
포스팅 주소 입력
올린글을 확인할 수 있는 포스팅 주소를 입력해 주세요.
네이버,다음,티스토리,스팀잇,페이스북,레딧,기타 등 각각 4개(20,000p) 까지 등록 가능하며 총 80,000p(8,000원)까지 적립이 가능합니다.