#Include Int Int: "Enter A Number: " "%D"
#Include Int Int: "Enter A Number: " "%D"
#Include Int Int: "Enter A Number: " "%D"
Multiplication Table
It is a method of defining a situation such that the very method is used in understanding the definition until an
acceptable level of understanding is attained. (Ikome, 2011)
Recursion is defined by
a) a base case or known case and
b) a general case which reduces to the base case.
Recursive functions: This is an algorithm that represents a recursion to return a value after a process.
The syntax of a Pascal function is as follows
Begin
Statements.
End;
If n = 0 then factorial=1
End;
begin
else fibo:=fibo(x-1)+fibo(x-2);
end;
end;
Exercise
Define a recursive function that evaluates the sum of the first n integers. E.g. Sum(4)=1+2+3+4
Or Sum(4)=10.
Corretion
Function sum(x);
Begin
Program factorial;
var x: integer;
begin
else fact:=n*fact(n-1);
end;
begin
readln(x);
readln;
end..
Program fibbo;
var i, n: integer;
begin
else fibo:=fibo(x-1)+fibo(x-2);
end;
begin
writeln('Give an integer');
readln(n);
writeln('The ',n,'th',' number in the
writeln;
i:=1;
repeat
write(' ',fibo(i):2);
i:=i+1;
1. write a program that evaluates the value of x raised to the power y i.e. (x y) where x and y are integers.
Use a power function in your program code.