Write a C program and enter two values to find the largest of them

Updated on technology 2024-04-10
3 answers
  1. Anonymous users2024-02-07

    Did you enter the format correctly? For example, enter a=1 and b=2! The format should be:

    1,2 and then press enter, because there is a comma in your scanf statement, so when you enter the data, there must be a comma between the data and the data, it is estimated that you are making a mistake here, and there is an improvement, it is best to have a prompt to enter information in front, add printf ( in the previous sentence of scanf"Please enter the two numbers (x, x) you want to compare

  2. Anonymous users2024-02-06

    # include

    void main()

    int max(int x,int y);

    int a,b,c;

    scanf("%d%d",&a,&b);

    c=max(a,b);

    printf("max=%d",c);

    return 0;

    int max(int x,int y)

    int z;

    if(x>=y) z=x;

    else z=y;

    return (z);

    Take a closer look at the content of scanf, there is an extra comma.

  3. Anonymous users2024-02-05

    Procedure C** is as follows:

    Analysis: 1. First, define four integer variables a, b, c, and max, and input three numbers a, b, and c;

    2. Define the maximum value as a, if the loop body or cycle b and c;

    3. Judge the maximum value according to the circulating body, and finally output the result.

    The basic structure of the C language

    Data type

    C's data types include: integer, character, real or float (single and double), enumeration, array, struct, common, pointer, and null.

    Constants and variables

    The value of a constant cannot be changed, and the name of the symbol constant is usually capitalized.

    A variable is the amount by which the value of an identifier can be changed. An identifier is a sequence of letters, numbers, or underscores that begin with a letter or underscore, note that the first character must be a letter or underscore, otherwise it is an invalid variable name. Variables are assigned a corresponding storage unit to them at compile time.

    array

    If a variable name is followed by a numeric parentheses, the declaration is an array declaration. A string is also an array. They end with ASCII's null as the array. It is important to note that the index value in the square brackets is calculated from 0.

    Strings

    C strings are actually written in the form of'\0'For char-type arrays ending in characters, you don't need to reference a library to use a glyph, but you need some functions in the C standard library to manipulate strings. They are different from arrays of characters. Using these functions requires referencing header files.

    File input and output

    In C, input and output are implemented through a set of functions in the standard library. In ANSI C, these functions are defined in header files; Middle.

Related questions
9 answers2024-04-10

<> method steps: 1. Open VC2010 (or other C language compilers), create a new project - select Win32 as the console application - name - OK. >>>More

7 answers2024-04-10

I'll fix it, friend, I don't want to divide it, hehe.

r=0; c=1;It is to assign an initial value to r and c. >>>More

7 answers2024-04-10

Place a button and 2 textboxes in the form, enter information in text1 during runtime, and see the output result in text2 after clicking the button. >>>More