Results 1 to 2 of 2
  1. #1

    Default Guys need help in fibonacci


    What do i need to change? So that I can get a result of 1 1 2 4 7
    #include<stdio.h>

    int main()
    {
    float a,maxn,b,c,d;
    printf("Enter maximumn number of values in series \n");
    scanf("%f",&maxn);
    a=1;b=1;
    printf("\n\n") ;
    printf("%1.0f\n",a);
    printf("%1.0f\n",a);
    for(d=1;d<=maxn-2;d++)
    {

    c=a+b;
    b=a;
    a=c;
    printf("%1.0f\n",c) ;

    }
    getch();
    }

  2. #2
    welcome diri sa istorya.net!

    Code:
    #include <stdio.h>
    
    int main(void)
    {
    	int a, b, c, d, m, x;
    
    	printf("Enter maximum number of values in series: ");
    	scanf("%d", &m);
    
    	a = 0;
    	b = 1;
    	c = 1;
    
    	printf("%d %d ", b, c);
    
    	for(x = 1; x <= m - 2; x++)
    	{
    		d = a + b + c;
    		a = b;
    		b = c;
    		c = d;
    
    		printf("%d ", d);
    	}
    
    	return 0;
    }

  3.    Advertisement

Similar Threads

 
  1. Guys need help sa business na carwash
    By mack0y in forum Business, Finance & Economics Discussions
    Replies: 7
    Last Post: 01-29-2013, 12:41 AM
  2. Guys need help hdd in raid 0..
    By acre020 in forum Computer Hardware
    Replies: 2
    Last Post: 03-05-2011, 01:34 PM
  3. Guys need help in choosing a scorpion
    By mence300 in forum Pet Discussions
    Replies: 9
    Last Post: 05-13-2009, 02:38 PM
  4. GUYS NEED HELP!!! ABOUT FLASH MP3 PLAYERs!!
    By tsunamibomb in forum Software & Games (Old)
    Replies: 0
    Last Post: 04-22-2006, 06:51 PM
  5. Want to buy a new mp3 player. Need help in selecting one.
    By metdumangas in forum Gizmos & Gadgets (Old)
    Replies: 21
    Last Post: 01-04-2006, 09:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top