Toggle navigation
Courses
Questions
Tags
Users
AC 20161102 作業1
2
like
0
dislike
3.9k
views
請設計一程式,使用者輸入一個正整數N,程式會輸出相對應的費氏數列第N項。
sample input:
10
sample output:
55
[Exercise]
Coding (C)
-
asked
Nov 2, 2016
in
作業
by
Shun-Po
(
18k
points)
ID: 16861 -
Available when:
Unlimited
-
Due to:
Unlimited
|
3.9k
views
comment
1
2
Called for Help
Please
log in
or
register
to add a comment.
44
Answers
0
like
0
dislike
Hidden content!
*** * ** ** *
* * * * ** ** **
#include<math.h>
int f1toN(int t){
* **** **** ***** * ** * * * i, num1 = 1, num2 = 1, j = 0;
** ** * ***** * ** * <= 0)
* *** *** * **** ** ** * ** * ** * * * * 0;
* *** * * ** *** * * ***** if((t == 1) || (t == 2))
**** *** * **** * * **** ***** ** * * *** **** 1;
* **** * ** * ****** ** *
* * ** ** ****** *** * *** * * * * * * * ** = 3; i <= t; i++){
* ** ***** * * ** ** * * ****** * ** ** * * * * * ** * * = num1 + num2;
* ** ** * ****** * ***** ** * *** ** *** ** ** **** * * ***** ** * *** * * = num2;
* ****** *** ** ** **** * * * *** ****** * * * * ** ** * ** ***** = j;
*** ** * * * * * ** ** ** ** ******* **** * *
** * * * * ** *******
***** ** ** *** * **** **** j;
}
int main(){
* ** * * ** ** ** * t;
* * * *** ***** *** * *** * * * * * * &t);
* * * **** ** * ***** **** ***** **** * *** f1toN(t));
return 0;
}
answered
Nov 2, 2016
by
410342026
(
-105
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
#include<stdio.h>
#include<math.h>
int printf1ton(int number)
{
int i,n1=1,n2=1,fi=0;
* ******* * * *** * * * * * * *** *** * * || (number==2))
* * * ** * * ** ****** ***** ** ******* ** ** * * ** 1;
* * * * * * * ***** * * ****** * **** *
* ** * * ** * * * *** * ** *** * *
*** *** * * * * ** * * *** * ** **** * ** ****** * * * * **** * * * * *
* * *** ** * * * * * * ** *** * ** * ** ** *** * *
* ****** * * * * *** * * * * * * * * * *** ** * * * ** * ** * * ** * *
* * ******* * * * **** * * * ** *** **** ** ** * *** **** * ** *** ** * ***
* *** ** *** * * ** **** * ** ** * * * * * * * ** ** * ** * * * **
** * ** * * *** **** ** * *** *** ** * ** ** * * * ** ** ***
* * ** * * * * ** ** * ** * * * ***
** *** * **** * * * * * * * **** * ** * *** fi;
}
int main()
{
int num,f;
* ***** ** * * * ** * **** * * *
** * * * ** *** * *** **
* * ** * **** ** * * ****** *** *
return 0;
}
answered
Nov 2, 2016
by
蘇瑋朝
(
-8
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
#include<stdio.h>
* * **** ****
int printfibon(int number);
int main()
{
*** * * * ** * * *** num,fibonnum;
**** ** * *** ***** **** * ** * *** * ***** * * *
* * ** * ** ** ***** ** * **** ******
** ** * * ** * * * * * * ** * ***** * * *
return 0;
}
int printfibon(int number)
{
** *** * * * ** * * * i,num1=1,num2=1,fi;
*** * *** ** * * ***** * (number==1||number==1)
**** * ****** * * * ** ** * * * ** **** ** ** 1;
** ***** **** *** * * * *
* *** ****** * ** * *** ** ** ** for(i=3;i<=number;i++)
** * **** ** * * * ** ** ** * * *** ** **** ***
* * ** * ** * * * * **** * * ** ** ** * ** ****** * ***** * *
* ** *** * * ** ** ** ** * * * * * * **** * * ******** *** *
** ** * ** ** *** * ** ** *** * *** *** * * * * * * *
**** * ** * * * *** * * ***** * * * *** * * ***
* **** * ** ** *** *** ** *** **
*** ** ** * * ** * fi;
}
answered
Nov 2, 2016
by
林佳慧
(
-85
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
#include ** * ** *
#include <math.h>
int f(int number)
{
* * * * *** * * * *** * ** ;
*** * *** * * * * * ;
* * **** ****** *** * ;
*** * ** * * **** (number>2)
** * ** * * * * * *
** * ***** * ** * *** *
* * * * * ****** ** * **** *** *
*** *** * * * * ** **** * * ** * * * * * *** * * * ***** = fsum[i-1] + fsum[i-2] ;
**** * * *** ** * * *** *** ****** **
* ** ** * * * ** *** ** * * * * fsum[number] ;
* ** *** * ****
*** **** *** ** * *****
* * *** ** ** *** 1 ;
}
int main()
{
** ** * ** fs,number ;
* *** **** ** * * *** **** ** * ***
*** * * * * ** * = f(number) ;
* ** ** *** * **** *
* * ** ** * **** * * 0 ;
}
answered
Nov 2, 2016
by
ert5179693
(
-60
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
#include * ** * * *
#include *** ** * * ***
#include ** ***** ****
int Fs(int * * *** * {
* * * *** ** * ** * ** * * * *
* * * * * if (number == 1)
* * printf * *** * * * **
**** else if (number == 2)
* ** printf *** ******
* * ** else
** for (x=3;x <= number ; x++){
** * * * * * * ** * ** * * * * * * *
* *** *** ** ** *** s=c+d;
*** ** ** ******* **** * ** c=d;
* * **** * * ** *** * * ** **
**** * ** * ** ****** * *** * ** * **** * * *** *** ** * ** ** * *** * * **** *** **** *** * * * **** * **** **** *** ****** * * ** * *** **** * ** * * ** *** * * ** * * * ** *** ****** * * *** * ****** *** *** **** * *** * * ** ** ******* * ** * ** * ** ** * * ** * **** ** **** * * *** * ** * ****** * ******** * ** ** *** * ******** * ** ****** ** * ** * * * * **** ** * * * *** ** * **** *** * * ***** * * * * **** ** ** *** * *** **** ** * ** * * **** **** * * * * * * ** ***** **** * ** * ** *** ** * *** **** *** ** ** ** ******* * * * * * **
** * ** ** }
** ** *** *
* * * * * * * ** * * * * s;
*** ** }
int main (void){
*
int number,a;
** * scanf * ***** * * * ** * ** *
*** * ** **
* *** printf * * *** * *
* ** return 0;
}
answered
Nov 2, 2016
by
410523007
(
-157
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
** * *** * * **
* *** * ** * * *
*** ** * * *** ****
* *
* = ** = * *
***** * * * *
* * = * *** ** ** = b + ** = ** c = **
* *** *
* *** **
*
** *
** ** ** * ** * * **
***
**** *** *** ** ** * *
*
*
** *
**
answered
Nov 2, 2016
by
410523022
(
-276
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
#include * ** * * * *
#include * *** * * **
int S(int N)
{
* ** ** *** * ** ***** * * * * *** ****** ;
*** *** * * * ****
* ** * * * *
* * * *** ** * * * a=1 ,b=1 ,i ,s=0;
*** * * ****** * * *** (i=3 ;i<=N ;i++)
** ** **** * *****
* * ** ** *** * * *** * * = a + b ;
* * * *** **** ** * = b ;
****** * * * * * *** *** *** = s ;
* * * * * *** * ***
**** ***** * * *** * * ** * * * ** ,s ) ;
* *** *** * *
}
int main()
{
***** **** *** * N ;
** * **** * *** * ** * * **** ** ,&N) ;
* * ** * *** ;
* * * * * *** ** * 0 ;
}
answered
Nov 2, 2016
by
luxinyu
(
-88
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
#include * * *****
#include **** ******* *
#include <math.h>
int fibonacci(int number)
{
*** ** * * * * ** * i , num1 = 1, num2 = 1, fibon = 0;
**** * * * * * * * (number <= 0)
* ** ***** * ** ** * * **
*** *** *** * ** ********** * * *** * * ****** * ** input positive number!");
** * ** * * **** ** * * * * ** *** *** **** 0;
** * ** * ** * *
* * ******* ** ****** * if ((number == 1)||(number == 2))
* ** ** * ** *** ** * ** ** ** ** * ** 1;
* ****** ******* *
**** * ** * * *
* *** * * * ** * * ** * ** ** (i = 3; i <= number;i++)
* * * ***** * * * * * ***** * * * * **
* ******** *** * *** ** ** * ****** * * ** * * * * * ** ** * **** ** = num1 + num2;
*** ** ** * * * *** * * * ** ** * ****** **** * ** = num2;
** * * * ** ** * ******* *** ******* ***** * * * ** * **** * * ** ** * = fibon;
* *** * *** * * *** * * * ** * * *** **** * * *
* * *** * *** ** ****
** *** *** **** ** * * fibon;
}
int main ()
{
* * * * ****** ** num, fibonNum;
***** ****** * * ** * * ** *** * ***** ***
** * * ** ** * ** ** = fibonacci(num);
* * * ** **** ** ** * * ** * * ** * * * fibonNum);
******* *** ** *** **** * * *** * ** *
* * * *** * * **** **** 0;
}
answered
Nov 2, 2016
by
Noah1011
(
43
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
#include * *** *
#include * *** *
#include ** * * *
int fibonacci(int number)
{
*** *** ** * **** ** * i, num1 = 1,num2 = 1, fibon = 0;
** ** ** **** * *** <= 0)
* **** ** *** ***** ** *
** * * *** ** ** ** * ** *** * ** ** *
** * * ** **** * **** * 0;
** * ** * ** ** *** ** *
* * * ***** * ** *** * * ** if((number == 1)||(number == 2))
* **** ** * ** * **** 1;
* * *** *** *** ** *
** **** * **** * * *
** ***** **** * * * (i = 3;i <= number;i ++)
* ****** * ** * *
******** ******** ** = num1 + num2;
** * * * * * *** *** = num2;
** ***** * * **** ** * = fibon;
* ****** ** * * * **
* **** * * * ** * ***
* * ** * * ** ** * fibon;
}
int main()
{ *** * * *** * num,fibonNum;
*** *** **** ** * * ***** * * * ****** * *
** * ** *** * ** * * ** ** = fibonacci(num);
**** * ** * ** ***** *** * **** * ** * *** ** ***
* * ** * * ** * * ** *** ** ** * * *
* ****** *** * * * * * 0;
}
answered
Nov 2, 2016
by
410425044
(
-114
points)
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
Hidden content!
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
int x(int num)
{
** * ******* *** ** ***** * ** ** * * * ** * i,c=0,num1=1,num2=1;
***** ** * * ** * * * * ******* * (num<=0)
* * * * * ** ****** * *** * ** * * *
*** **** * * ********* ** ** **** * * * * ** * ** ** ** *** **** * **** ** * ("Please input postive number!");
* ** **** *** * * * ** * ** ** ******* * ** *** 0;
* *** ** * ** ** ** * * ** * * *
***** * * * *** ** * **** * * *** * ** if ((num == 1)||(num == 2))
** * ***** * * ** ** *** ** ** * * * ** ** * * ** 1;
* ******** ** ** ** *** * * ** ** ***
* * * *** *** * ** * * * ** * ** * *
* **** * * ** * **** **** ** ** ************** (i=3;i<=num;i++)
* * *** **** * *** * * * * **** * ** * * *
* ** ** *** ** * * ** * * * ** * ** * * * ** * **** * ** *** * * *****
* ****** * * * *** * * * * ** **** * * * * * * * **** ***** ** * ** * * ** **
* ** * ** * *** * * ** ** ** * ** * *** * * * ** * ****** ** * * * *** = c;
***** * * * * ** *** ***** *** * * * * ** *****
* * **** * * *** * **** *** *******
** ** *** ** * *** * * * c;
}
int main()
{
int s,b;
* ** * * * ** **** *** ("%d",&b);
* * *** ** * *** *** **** ** **
* ********* * * *** ** ** ** * *
return 0;
}
answered
Nov 2, 2016
by
410523016
(
-136
points)
ask related question
comment
Please
log in
or
register
to add a comment.
Page:
« prev
1
2
3
4
5
next »
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English
中文
Tiếng Việt
IP:172.70.127.99
©2016-2025
Related questions
1
like
0
dislike
48
answers
AC 20161102 作業2
[Exercise]
Essay (Open question)
-
asked
Nov 2, 2016
in
作業
by
Shun-Po
(
18k
points)
ID: 16865 -
Available when:
Unlimited
-
Due to:
Unlimited
|
4.2k
views
1
like
0
dislike
129
answers
AC 20161019 作業 1
[Exercise]
Coding (C)
-
asked
Oct 19, 2016
in
作業
by
Shun-Po
(
18k
points)
ID: 14119 -
Available when:
Unlimited
-
Due to:
Unlimited
|
8.6k
views
0
like
0
dislike
117
answers
AC 20161013 作業 1
[Exercise]
Coding (C)
-
asked
Oct 13, 2016
in
作業
by
Shun-Po
(
18k
points)
ID: 13581 -
Available when:
Unlimited
-
Due to:
Unlimited
|
7.3k
views
0
like
0
dislike
131
answers
AC 20161005 作業 1
[Exercise]
Coding (C)
-
asked
Oct 5, 2016
in
作業
by
Shun-Po
(
18k
points)
ID: 12291 -
Available when:
Unlimited
-
Due to:
Unlimited
|
8.2k
views
0
like
0
dislike
121
answers
AC 20160921 作業1
[Exercise]
Essay (Open question)
-
asked
Sep 21, 2016
in
作業
by
Shun-Po
(
18k
points)
ID: 11340 -
Available when:
Unlimited
-
Due to:
Unlimited
|
7.7k
views
12,783
questions
183,442
answers
172,219
comments
4,824
users