- This topic has 1 reply, 2 voices, and was last updated 16 years, 8 months ago by .
Viewing 1 reply thread
Viewing 1 reply thread
- The forum ‘C Programming’ is closed to new topics and replies.
Home › Forums › C Programming › how to create a program of Lucas No. using Turbo C
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..
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #include <br /> #include <br /> void main()<br /> {<br /> int num,i;<br /> unsigned long n1=1,n2=3,s;<br /> clrscr();<br /> printf("nENTER A NUMBER: ");<br /> scanf("%d",&num);<br /> printf("nLUCAS SEQUENCE UPTO %d NUMBERS IS: n",num);<br /> printf("%lu %lu",n1,n2);<br /> for(i=1;i<=num-2;i++)<br /> {<br /> s=n1+n2;<br /> printf(" %lu",s);<br /> n1=n2;<br /> n2=s;<br /> }<br /> getch();<br /> } |