作业帮 > 综合 > 作业

C语言 写出下列程序在由键盘输入0、1、2、3、4、5时的输出结果.

来源:学生作业帮 编辑:拍题作业网作业帮 分类:综合作业 时间:2024/04/30 12:32:52
C语言 写出下列程序在由键盘输入0、1、2、3、4、5时的输出结果.
#include
#define MUL(a,b) (a*b)
#define SQU(a) ((a)*(a))
void main(){
int i=0,j=2,k=3;
scanf("%d",&i);
switch(i){
case 0:j=123;break;
case 1:j=MUL(j+k,i+3);break;
case 2:j=SQU(++j);break;
case 3:printf("%d#",SQU(j++));break;
case 4:for(k=0;k
VC2005的结果.宏定义不带括号,直接传递进去两个数相加,与预期的结果肯定是不一样的.
123
8
16
4#4
%%**2
**2