C Program to Find Largest Number

To output the largest number, you can compare the two numbers and then output the larger one.

Here is the code example:

#include <stdio.h>

int main() {
    int num1 = 10;
    int num2 = 20;
    
    if(num1 > num2) {
        printf("最大的数字是: %d\n", num1);
    } else {
        printf("最大的数字是: %d\n", num2);
    }
    
    return 0;
}

In the code above, we have defined two integer variables, num1 and num2, and then compared their values to output the larger number. In this example, the result is that the largest number is 20. You can modify the values of the variables or add more conditions according to your specific needs.

bannerAds