Add example inputs
This commit is contained in:
30
examples/lucas_number/lucas_number.mc
Normal file
30
examples/lucas_number/lucas_number.mc
Normal file
@@ -0,0 +1,30 @@
|
||||
void lucas_number (int x, int y, int num){
|
||||
int z;
|
||||
z=0;
|
||||
while(num >= x)
|
||||
{
|
||||
print_int(x);
|
||||
print(", ");
|
||||
z=x+y;
|
||||
x=y;
|
||||
y=z;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int num;
|
||||
print("Enter the limit of the Lucas number:");
|
||||
print_nl();
|
||||
x=2;
|
||||
y=1;
|
||||
num= read_int();
|
||||
print("The Lucas numbers are: ");
|
||||
lucas_number(x, y, num);
|
||||
print_nl();
|
||||
|
||||
return 0;
|
||||
}
|
1
examples/lucas_number/lucas_number.stdin.txt
Normal file
1
examples/lucas_number/lucas_number.stdin.txt
Normal file
@@ -0,0 +1 @@
|
||||
125
|
2
examples/lucas_number/lucas_number.stdout.txt
Normal file
2
examples/lucas_number/lucas_number.stdout.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
Enter the limit of the Lucas number:
|
||||
The Lucas numbers are: 2, 1, 3, 4, 7, 11, 18, 29, 47, 76, 123,
|
Reference in New Issue
Block a user