c_cpp 用于检查给定整数是正还是负的C程序

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c_cpp 用于检查给定整数是正还是负的C程序相关的知识,希望对你有一定的参考价值。

//C program to check whether a given integer is positive or negative

#include <stdio.h>


int main() {

	int num;

	printf("Enter a number: ");
	scanf("%d", &num);

	if (num >= 0) {
		printf("This is Positive Number.\n");

	}
	else {
		printf("This is negative Number.\n");
	}

	return 0;
}

以上是关于c_cpp 用于检查给定整数是正还是负的C程序的主要内容,如果未能解决你的问题,请参考以下文章