C program to find maximum value out of 2 values

Program:

#include <stdio.h>


int maximum(int x, int y);


void main()

{

    int a=10, b=20, max=0;

    

    max=maximum(a,b);

    

    printf("Maximum value is: %d",max);

}


int maximum(int x, int y)

{

    if(x>y)

        return x;

    else

        return y;

}


Output:

Maximum value is: 20


Drafted on 🌏 by,

Jal


peace

Comments

Popular posts from this blog

C program to read and display book information using structure

Count positive, negative and zero values in an array

Maximum value from array