C language: find the larger of three integers

Simple c

Today is the first day I decided to learn programming and development. Because of class and fitness reasons, I only read the first two chapters of C, so I only wrote a code. What do you think
of the larger of the three integers
Insert picture description here
Insert picture description here ? It may be that I haven't programmed for a long time, because I have been thinking about postgraduate entrance examinations before, so I haven't written my own programs for a long time, which caused many errors.
1. Forgot to add parentheses after the main function.
2. Obviously there are three variables, but I only added two %d after scanf.
3. In scanf("%d,%d"), commas are used between %d, so in the execution of the program, commas should be used when entering variable values, such as (2,3); if %d is Spaces are used in between, and spaces are used for input.
4. The algorithm is still unclear. Simple three numbers are not the simplest way to compare.
5. The declaration function is that the max function can be written in the main function, or it can be written to the top.
6. As for the max function, there is another way to write
int max(int ​​a,int b,int c)
{if(a<b){ if(b<c) return c; if(b>c ) Return b;} else if (a>b) { if (b>c) return a; if (c>a) return c;} }





Find the largest value among N numbers and output it.
This needs to be used in the following loop, so I won't write it out here, and write it later.

Guess you like

Origin blog.csdn.net/m0_52405419/article/details/115313005