<pre name="code" class="cpp">//  将正数变成相应的负数,将负数变成相应的正数

#include <stdio.h>

int turn(int a)
{
	a = ~a + 1;
	return a;
}

int main()
{
	printf("%d\n", turn(5));
	printf("%d\n", turn(0));
	printf("%d\n", turn(-1));
	return 0;
}




【c语言】将正数变成相应的负数,将负数变成相应的正数

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-17
  • 2021-06-17
  • 2022-12-23
  • 2021-08-11
  • 2021-12-21
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-27
  • 2022-01-03
相关资源
相似解决方案