zzulioj 1038: Maximum absolute value

Title description
Enter 3 integers and output the number with the largest absolute value.
Input The
input contains 3 integers in the range of int, separated by spaces.
Output
Output the number with the largest absolute value among the three numbers, on a separate line. If the number with the largest absolute value is not unique, the one that appears first is output. For example, if the input is 1 -3 3, the output is -3; if the input is 1 3 -3, the output is 3.
Sample input Copy
1 2 -3
Sample output Copy
-3

#include<stdio.h>
#include<math.h>
int main()
{
    
    
	int a, b, c, max;
	scanf("%d%d%d",&a,&b,&c);
	max=a;
	if(abs(max)<abs(b))
	  max=b;
	  if(abs(max)<abs(c))
	    max=c;
	printf("%d\n",max);
	return 0;
 } 

Guess you like

Origin blog.csdn.net/m0_53024529/article/details/112863500