Visual prolog is a software of artificial intelligence(AI).Before we start the programming in the visual prolog ,we should install the programand we must write the code in it.and the thing we should consider is wemust save thefile in .PRO file and be placed at the location where it is stored in C: drive.(C: VIP/BIN/WIN/32).
Here is the code to find the HCF of two numbers in visual prolog:
%TO FIND THE HCF OF TWO NUMBERS
PREDICATES
hcf(integer, integer, integer)
CLAUSES
hcf(X, Y, X):-
Y mod X = 0.
hcf(X,Y,Z):-
S = Y mod X,S<>0, hcf(S, X, Z).
GOAL
hcf(5,10,X).
OUTPUT:
To find the output press the G button on the top of the software. the output of the above program looks like this
CONCEPT:
here the concept is that when the number is divided exactly by the smaller number or the divisor,then the divisor is the required hcf.
and if there is remainder in the division, then the hcf of the remainder and the previous divisor is found repeadtly until the remainder is 0,
in the above example,10 %5 is 0 so the HCF is 5.
in 20 and 30, 30%20=10
since remainder is not 0,we should find now HCF of 20 and 10 ,here remiander is 0.so HCF is 10.
Here is the code to find the HCF of two numbers in visual prolog:
%TO FIND THE HCF OF TWO NUMBERS
PREDICATES
hcf(integer, integer, integer)
CLAUSES
hcf(X, Y, X):-
Y mod X = 0.
hcf(X,Y,Z):-
S = Y mod X,S<>0, hcf(S, X, Z).
GOAL
hcf(5,10,X).
OUTPUT:
To find the output press the G button on the top of the software. the output of the above program looks like this
CONCEPT:
here the concept is that when the number is divided exactly by the smaller number or the divisor,then the divisor is the required hcf.
and if there is remainder in the division, then the hcf of the remainder and the previous divisor is found repeadtly until the remainder is 0,
in the above example,10 %5 is 0 so the HCF is 5.
in 20 and 30, 30%20=10
since remainder is not 0,we should find now HCF of 20 and 10 ,here remiander is 0.so HCF is 10.
Hi! You have a very good blog that the main thing is a lot of interesting and useful information is here. Thanks for posting . . .
ReplyDeletepacking and unpacking services hyderabad.
betmatik
ReplyDeletekralbet
betpark
tipobet
slot siteleri
kibris bahis siteleri
poker siteleri
bonus veren siteler
mobil ödeme bahis
D10RQ
bahis siteleri
ReplyDeletehttps://bahissiteleri.io
youwin
bets10
1xbet
1RE
salt likit
ReplyDeletesalt likit
heets
canlı sex hattı
https://girisadresi.info/
5EZ
alanya
ReplyDeleteamasya
ankara
antakya
antalya
S2EW