C语言题目 高分求解

2024-11-22 16:08:54
推荐回答(2个)
回答(1):

#include
int main()
{
long opt1_bit3;
long opt2_bit2;
long result1;
long result2;
long total;
char index1[] = "(1)";
char index2[] = "(2)";
scanf("%ld", &opt1_bit3);
printf("*");
scanf("%ld", &opt2_bit2);
result1 = opt1_bit3 * (opt2_bit2 % 10);
result2 = opt1_bit3 * ((opt2_bit2 / 10) * 10);
total = result1 + result2;
printf("\n");
printf("__________\n");
printf("%s", index1);
if (result1 / 1000 == 0)
printf(" %ld\n", result1);
else
printf(" %ld\n", result1);
if (result2 / 10000 == 0)
printf(" %ld\n\n", result2);
else
printf(" %ld\n\n", result2);
printf("__________\n");
printf("%s", index2);
printf("%ld\n", total);
return 0;
}

运行实例结果:
591
*19

__________
(1) 5319
5910

__________
(2)11229

这网页上看,没对齐,但是在机器上的终端输出中,是对齐的。自己可以复制我代码试一下!

回答(2):

哎,这也找人