C语言:宏完美定义

#include <stdio.h>
#define M (n*n+3*n)
#define M1 n*n+3*n
int main(){
    int sum, n;
    printf("Input a number: ");
    scanf("%d", &n);
    sum = 3*M+4*M+5*M;
    printf("sum=%d\n", sum);
    sum = 3*M1+4*M1+5*M1;
    printf("sum=%d\n", sum);
    return 0;
}

 

posted @ 2021-03-18 08:55  myrj  阅读(69)  评论(0编辑  收藏  举报