Skip to main content

Generate Fibonacci series below 100( 0 ,1, 1, 2 ,3 ,5,8………..)

PROCEDURE:-

    1.set i to 3, set a=0,b=1,
    2. repeat steps 3 to 5 until i is less than or equal 100 incrementing i by 1 each time
    3. compute c=a+b
    4.print value of c
    5. set a=b,b=c  
CODE:-

#include<stdio.h>
void main()
{
int i=3, a=0,b=1 ,c;
printf(“Fibonacci series below 100 are :\n”);
printf(“%3d %3d”,a,b);
while(i<=100)
    {
      c=a+b;
      printf(“%3d”,c);
      a=b;
      b=c;
      i++;
     }
}


Output:- Fibonacci series below 100 are
            0 1 1 2 3 5 8 13………………

Comments

Popular posts from this blog

Find Value of S=ut+1/2*a*t**2.

PROCEDURE:-        1.enter values for u,a,t to find distance        2.find distance with the formulae ut+1/2at 2        3.print the above result CODE:- #include<stdio.h> #include<conio.h> void main() {   float u,t,a,S;   clrscr();   printf(“enter values u,t,a”);   scanf(“%f %f %f”, &u,&t,&a);   S=(u*t)+(0.5*a*t*t);   printf(“\n  S = %f”, S); } Input:- enter values u,t,a               U=10,t=4,a=4.9 Output:- S =79.200