The c++ expression statement training program inputs the number of apples m and the number of people n, and is required to output the average number of apples each person can get, and store the calculation results in the variable x.

#include <stdio.h>

// define the main function

int main()

{

    // Define variables, m-number of apples, n-number of people, x-number of apples per capita

    int m, n, x;

    // Please add code between Begin-End to calculate the number of apples per capita

    /********** Begin *********/

    scanf("%d%d",&m,&n);

    //printf("The per capita apple tree is:");

    //printf("%d\n",x);

    //cin>>m>>n;

    //cout<<"The per capita apple tree is:"<<x<<endl;

    x = m/n;

    /********** End **********/

    // Output the number of apples per capita

    printf("The number of apples per capita is: %d",x);

    return 0;

}

Supongo que te gusta

Origin blog.csdn.net/m0_61625235/article/details/121912457
Recomendado
Clasificación