【c语言】求绝对值 // 求绝对值#include <stdio.h>int fabs(int a) {if (a < 0){a = ~a + 1;}return a; }int main() {printf("绝对值是:%d\n", fabs(5));printf("绝对值是:%d\n", fabs(0));printf("绝对值是:%d\n", fabs(-1));return 0; } Published by 风君子 独自遨游何稽首 揭天掀地慰生平 View all posts by 风君子