20_09

Write a Prolog program to implement max(X,Y,Max) so that Max is the greater of two numbers X and Y.

 Source Code :

 

max(X,Y,R):-

 X>=Y ->

  R is X,

  write(R)

 ;

  R is Y,

  write(R).

  

Output :

Prolog program to implement max(X,Y,Max) so that Max is the greater of two numbers X and Y


No comments:

Post a Comment

Write a program in C to convert a decimal number to binary using recursion.

 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...