Home Forums C Programming how to create a program of Lucas No. using Turbo C

Viewing 1 reply thread
  • Author
    Posts
    • #2069
      pritaj.mhaske
      Participant

      how can i make a program of Lucas No. using Turbo C??
       
      pls help me solve my project regarding the use of the Turbo C program..
       
      that is all..
       
      thank you..
       
       

    • #3333
      yeswanth
      Participant

      The first few numbers of Lucas sequences which is a variation of Fibonacci sequence are sequence are
      1 3 4 7 11 18 29
      a) Design a program in C to generate Lucas sequence.
      b) Develop a function to calculate sum of first n odd integers.

      #include 
      #include
      void main()
      {
      int num,i;
      unsigned long n1=1,n2=3,s;
      clrscr();
      printf("nENTER A NUMBER: ");
      scanf("%d",&num);
      printf("nLUCAS SEQUENCE UPTO %d NUMBERS IS: n",num);
      printf("%lu %lu",n1,n2);
      for(i=1;i<=num-2;i++)
      {
      s=n1+n2;
      printf(" %lu",s);
      n1=n2;
      n2=s;
      }
      getch();
      }
Viewing 1 reply thread
  • The forum ‘C Programming’ is closed to new topics and replies.