User Profile

Collapse

Profile Sidebar

Collapse
kookai
kookai
Last Activity: Aug 5 '06, 10:14 PM
Joined: Jul 27 '06
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • kookai
    replied to Fibonacci Series
    in C
    #include<iostre am>
    using namespace std;
    Code:
    int fibonacci(int n)
    {
      int x1 = 0, fib;
      int x2 = 1;
      if(n >= 1)
      {
        for(int i=2;i<= n; i++)
        {
          fib = x1+ x2;
          x1 = x2;
          x2 = fib;
        }
      }
    
      return fib;
    }
    int main(){
      for(int i=2;i<=10;i++) {
        cout<<fibonacci(i)<<endl;
    ...
    See more | Go to post
    Last edited by Frinavale; Sep 28 '10, 02:13 PM. Reason: Please post code in code tags.

    Leave a comment:


  • kookai
    replied to Fibonacci Series
    in C
    G'day

    where error?

    1 error(s), 0 warning(s)



    Code:
    # include <iostream.h>
    int fibonacci(int n)
    {
    int x1 = 0, fib;
    int x2 = 1;
    if(n >= 1)
    {
    for(int i=2;i<= n; i++)
    {
    fib = x1+ x2;
    x1 = x2;
    x2 = fib;
    }
    
    return fib;
    }
    See more | Go to post
    Last edited by Frinavale; Sep 28 '10, 02:12 PM. Reason: Please post code in code tags.

    Leave a comment:


  • kookai
    started a topic Fibonacci Series
    in C

    Fibonacci Series

    hi
    I need help with this problem. I have tried writting the program, i just can not get it to run properly.

    Please Write
    The Fibonacci series
    0, 1, 1, 2, 3, 5, 8, 13, 21, ...
    begins with the terms 0 and 1 and has the property that each succeeding term is the sum of the two preceding terms.
    (a) Write a nonrecursive function fibonacci( n ) that calculates the nth Fibonacci number.

    ...
    See more | Go to post

  • kookai
    started a topic Having trouble with my code for hw assignment
    in C

    Having trouble with my code for hw assignment

    I need help with this problem. I have tried writting the program, i just can not get it to run properly.

    Please Write a function qualityPoints that inputs a student's average and returns 4 if a student's average is 90 - 100, 3 if the average is 80 - 89, 2 if the average is 70 - 79, 1 if the average is 60 - 69 and 0 if the average is lower than 60.

    Look tried
    put where the error?

    #include <iostream.h>...
    See more | Go to post
No activity results to display
Show More
Working...