C language keeps entering integer pairs a b, outputs the larger number of them, and ends when 0 0 is

Updated on technology 2024-06-12
6 answers
  1. Anonymous users2024-02-11

    #include

    main()

    int x,y;

    while(1)

    printf("Enter two pieces of data, separated by spaces:");

    scanf("%d%d", &x,&y);

    if (x==0 &&y==0) return;

    printf("The maximum number of both is %d", x>y?x:y);

  2. Anonymous users2024-02-10

    #include

    int main(void)

    int x=1,y=1;

    while(!(x==0 &&y ==0))scanf("%d %d",&x,&y);

    if(x > y)

    printf("The large value is %d",x);

    else if(x < y)

    printf("The large value is %d",y);

    elseprintf("The two values are equal");

    printf("End the program");

  3. Anonymous users2024-02-09

    Enter an integer a, if the number is positive, how to express the output number in the C language program**?

    Enter an integer a, if the number is positive, how to express the output number in the C language program**? Hello dear, 1. Symbols are also part of the number and should also be reflected in the memory. The sign is only positive and negative, and a bit is sufficient; In C, the highest bit of memory is used as the sign bit.

    2. In the C language, it is stipulated that in the sign bit, 0 is used to represent a positive number and 1 is used to represent a negative number. 3. C language allows us to do this, if you don't want to set the sign bit, you can add the unsigned keyword in front of the data type, I hope my answer will be helpful to you, Finally, I wish you good health and a happy mood!

  4. Anonymous users2024-02-08

    The program involves the nesting of if statements, and the specific algorithm is a logical algorithm that compares three numbers:

    1) Take any 2 numbers out of 3 numbers and compare them, and assign the larger number to max;

    2) Compare the remaining number with the maximum value assigned in the previous step, and assign the larger number to max;

    3) Output maximum.

    The specific procedure is as follows:

    #include int main(void)

  5. Anonymous users2024-02-07

    1. Create a new BAI project and. c file, input header du file and main function zh. 2. Define variable types and DAOs

    Assign initial value. 3. Input version.

    Integer weights. 4. Calculate the length of the integer with a for loop.

    5. Use the for loop to store the numbers into the array.

    6. Output the array with a for loop.

    7. Compile, output the minimum value.

  6. Anonymous users2024-02-06

    Hope it helps! Here's the procedure: include include int iseven(int x)int main().

    printf("the sum of the odd numbers is: %d",sumofodd);

    system("pause");

    return 0;}

Related questions
4 answers2024-06-12

1 Enter three numbers.

2 Compare the first two to get the greater of the first two. >>>More

10 answers2024-06-12

In C, you can't actually get carriage returns with any method (regular library functions). Because the console is after you enter a line and click enter, send the characters other than the enter to the program input cache together, you can only use workarounds, such as getting a line, a character or a number at a time, and setting multiple inputs, then after entering, it will inevitably go into the next input or ** block. >>>More

15 answers2024-06-12

This is not understood in this way, e.g. char value = 'a'; char value2 = 97;Then value == value2, the two values are equal. But they are all basic types and take up 1 byte. >>>More

4 answers2024-06-12

#include

main() >>>More

14 answers2024-06-12

chopping | rounding

Floating-point numbers are like sand in your hands, always inadvertently trying to flow away a little. >>>More