#include <stdio.h> int main( void ) { puts( "请输入a和b的值:" ); int a,b; scanf( "%d%d", &a, &b ); int c = a>b ? a-b : a+b; printf( "输出值为c: %d\n", c ); }
[此贴子已经被作者于2020-1-12 11:33编辑过]
#include <stdio.h> #include <stdlib.h> main() { int a,b,c; printf("请输入a和b的值:\n"); scanf("%d %d",&a,&b); c=(a>b)?(a-b):(a+b); printf("输出值为:%d\n",c); }