Source Code :
evenlength:-
write('true --> even').
oddlength:-
write('true --> odd').
oddeven([_H|T]):-
length(T,L),
L>=0 ->
(
L1 is L+1,
L2 is mod(L1,2),
L2=:=0 ->
evenlength
;
oddlength
).
Output :
In cs-assign blog you can find various types of computer program. Such as, programs in C, Java, Prolog etc.
Source Code :
evenlength:-
write('true --> even').
oddlength:-
write('true --> odd').
oddeven([_H|T]):-
length(T,L),
L>=0 ->
(
L1 is L+1,
L2 is mod(L1,2),
L2=:=0 ->
evenlength
;
oddlength
).
Output :
Source code: //Write a program in C to convert a decimal number to binary using recursion. #include<stdio.h> long convertB_to_D(int d...
No comments:
Post a Comment