20_09

Write a prolog program to find the maximum of two numbers

 Source Code :

 

max(X,Y):-

( 

 X=Y ->

  write('Both are equal')

 ;

 X>Y ->

  (

  Z is X,

  write(Z)

  )

  ;

  (

  Z is Y,

  write(Z)

  )

).

 

Output :


Write a prolog program to find the maximum of two numbers

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