How do i write an ipo chart based on the fibonacci method?


This is what I wrote up based on the Fibonacci method but when it came down to doing an IPO chart around it I seem to get stuck in the processing phase. I know this might be something that should be easy to do but I'm relatively new to this.

This is an example of another IPO chart:

enter image description here

#include<stdio.h>
#include<string.h>
main()
{
  int n,t=0,tt=1,b=0,i;
  printf("Enter sequence limit: ");
  scanf("%d",&n);
  printf("Fibonacci sequence: %d %d",t,tt);
  b=t+tt;
  for (i=1;b<=n;i++)
  {
    printf(" %d ",b);
    t=tt;
    tt=b;
    b=t+tt;
  }
return 0;
}

Answers:


The condition in loop was incorrect:

for (i=1;b<=n;i++)

You need i<=n not b<=n, since you need n sequence numbers.

#include<stdio.h>
#include<string.h>
int main(void)
{
  int n,t=0,tt=1,b=0,i;

  printf("Enter sequence limit: ");
  scanf("%d",&n);

  printf("Fibonacci sequence: %d %d\n",t,tt);

  b=t+tt;
  for (i=1; i<=n; i++)
  {
    printf(" %d ",b);
    t=tt;
    tt=b;
    b=t+tt;
  }
return 0;
}

Output:

Enter sequence limit: 10                                                                                                                     
Fibonacci sequence: 0 1                                                                                                                      
 1  2  3  5  8  13  21  34  55  89

In the light of new information regarding IPO:

#include<stdio.h>

int main(void){
    float weekly_pay;
    float raise;
    float weekly_raise;
    float new_weekly_pay;

    // 1. current weekly pay:
    printf("Enter weekly_pay: \n");
    scanf("%f",&weekly_pay);

    // 2. raise rate
    printf("Enter raise: \n");
    scanf("%f",&raise);

    // 3. weekly raise
    weekly_raise = weekly_pay * raise;

    // 4.new weekly pay
    new_weekly_pay = weekly_pay + weekly_raise;

    // 5. Output:
    printf("New weekly pay is: %8.2f \n", new_weekly_pay);

    return 0;
}

Input:

100.0
0.01

Output:

New weekly pay is:   101.00