How to define Max in define in c
// For defining x > y
#define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))
// For defining x < y
#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
How to define Max in define in c
// For defining x > y
#define MAX(X, Y) (((X) > (Y)) ? (X) : (Y))
// For defining x < y
#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
max number in c
#include <stdio.h>
#include <stdlib.h>
int main()
{
double num1,num2,maxNum,minNum;
printf("Enter a number: ");
scanf("%lf", &num1);
printf("Enter another number: ");
scanf("%lf", &num2);
printf("\n");
if (num1 > num2){
maxNum = num1;
minNum = num2;
printf("The largest number is %f \n",maxNum);
printf("The smallest number is %f \n",minNum);
}else if (num1 < num2){
maxNum = num2;
minNum = num1;
printf("The largest number is %f \n",maxNum);
printf("The smallest number is %f \n",minNum);
}printf("The numbers are equal");
return 0;
}
max function c
#define new_max(x,y) (((x) >= (y)) ? (x) : (y))
#define new_min(x,y) (((x) <= (y)) ? (x) : (y))
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us