mirror of
https://github.com/Hizenberg469/C1-Linux_SYS_Prog-AS-.git
synced 2026-04-20 02:42:23 +03:00
45 lines
925 B
C
45 lines
925 B
C
/*
|
|
* =====================================================================================
|
|
*
|
|
* Filename: common_math.c
|
|
*
|
|
* Description:
|
|
*
|
|
* Version: 1.0
|
|
* Created: 04/02/24 07:32:41 PM IST
|
|
* Revision: none
|
|
* Compiler: gcc
|
|
*
|
|
* Author: YOUR NAME (),
|
|
* Organization:
|
|
*
|
|
* =====================================================================================
|
|
*/
|
|
|
|
#include "common_math.h"
|
|
#include <stdio.h>
|
|
|
|
double add (double a, double b){return b + a;}
|
|
double sub (double a, double b){return a - b;}
|
|
double mul (double a, double b){return a * b;}
|
|
double div (double a, double b){
|
|
if (b == 0){
|
|
printf("divide by zero not allowed\n");
|
|
return 0;
|
|
}
|
|
return a / b;
|
|
}
|
|
|
|
double max (double a, double b){
|
|
if(a > b)
|
|
return a;
|
|
return b;
|
|
}
|
|
|
|
double min (double a, double b){
|
|
if(a > b)
|
|
return b ;
|
|
return a;
|
|
}
|
|
|