C语言 宏定义练习:关键词 II 与符号

北慕城南 提交于 2019-12-30 02:52:19

题目描述

#include <stdio.h>
/******************************************/
/// Write your code here,
/// beginning with “#define”…
/******************************************/
int main()
{
int x, s, n, i;
scanf("%d", c n);
if(s = i = 0; i < n; i++)
{
scanf("%d", c x);
s += x;
}
printf("%d\n", s);
return 0;
}

输入

输出

样例输入 Copy

5
1 2 3 4 5

样例输出 Copy

15

代码

#include <stdio.h>
/******************************************/
/// Write your code here,
///    beginning with "#define"...

#define c &
#define if for

/******************************************/
int main()
{
    int x, s, n, i;
    scanf("%d", c n);
    if(s = i = 0; i < n; i++)
    {
        scanf("%d", c x);
        s += x;
    }
    printf("%d\n", s);
    return 0;
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!