Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

PROGRAM USNG WHILE LOOP FOR THE FIBONANSI SERIES SERIES :: 1 1 2 3 5 8 13...

Posted By: Bonifacio Garcia     Category: C Programming     Views: 6175

WRITE A PROGRAM USNG WHILE LOOP FOR THE FIBONANSI SERIES.

SERIES :: 1 1 2 3 5 8 13...

Code for PROGRAM USNG WHILE LOOP FOR THE FIBONANSI SERIES SERIES :: 1 1 2 3 5 8 13... in C Programming

#include <stdio.h>
#include <conio.h>
#include<math.h>


void main()
{
int n1,n2,n,s=0,i;
clrscr();
printf("Enter the No For Siries :- ");
scanf("%d",&n);
n1=0;
n2=1;
printf("\n");
    for(i=1;i<=n;i++)
    {
       printf("%d  ",n2);
       s=n1+n2;
       n1=n2;
       n2=s;
    }
getch();

}
/*
********
OUTPUT
********

Enter the No :- 678

The sum of digit is = 21
*/
  
Share: 



Bonifacio Garcia
Bonifacio Garcia author of PROGRAM USNG WHILE LOOP FOR THE FIBONANSI SERIES SERIES :: 1 1 2 3 5 8 13... is from Barcelona, Spain.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!