Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
34
Task/Leonardo-numbers/C/leonardo-numbers.c
Normal file
34
Task/Leonardo-numbers/C/leonardo-numbers.c
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#include<stdio.h>
|
||||
|
||||
void leonardo(int a,int b,int step,int num){
|
||||
|
||||
int i,temp;
|
||||
|
||||
printf("First 25 Leonardo numbers : \n");
|
||||
|
||||
for(i=1;i<=num;i++){
|
||||
if(i==1)
|
||||
printf(" %d",a);
|
||||
else if(i==2)
|
||||
printf(" %d",b);
|
||||
else{
|
||||
printf(" %d",a+b+step);
|
||||
temp = a;
|
||||
a = b;
|
||||
b = temp+b+step;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int a,b,step;
|
||||
|
||||
printf("Enter first two Leonardo numbers and increment step : ");
|
||||
|
||||
scanf("%d%d%d",&a,&b,&step);
|
||||
|
||||
leonardo(a,b,step,25);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue