2-1输入两个整数num1和num2,计算并输出他们的和、差、积、商与余数

时间:2020-12-30 11:00:42
#include<stdio.h>
int main(void)
{
    int num1,num2,sum,difference,product,quotient,remainder;
    

    printf("Enter num1:");
    scanf("%d",&num1);
    printf("Enter num2:");
    scanf("%d",&num2);
    sum=num1+num2;/*计算两数的和*/
    printf("sum=%d\n",sum);
    difference=num1-num2;
    printf("difference=%d\n",difference);
    product=num1*num2;
    printf("product=%d\n",product);
    quotient=num1/num2;
    printf("quotient=%d\n",quotient);
    remainder=num1%num2;/*计算数的余数*/
printf(
"remainder=%d\n",remainder); return 0; }

2-1输入两个整数num1和num2,计算并输出他们的和、差、积、商与余数