C程序检查一个数是正数还是负数还是零?

2023年 8月 27日 60.6k 0

C程序检查一个数是正数还是负数还是零?

A number which is greater than 0 is positive and less than 0 are negative. The concept of positive and negative is very important in number theory and programming also. Calculations rely on this concept only.

Input: 0
Output:0 is zero

登录后复制

Explanation

Using conditional statement check the number with 0 weather it is greater than 0 or smaller than 0.

Example

#include
using namespace std;
int main() {
int n=0;
if(n>0) {
printf("%d is positive",n);
} else if(n

相关文章

JavaScript2024新功能:Object.groupBy、正则表达式v标志
PHP trim 函数对多字节字符的使用和限制
新函数 json_validate() 、randomizer 类扩展…20 个PHP 8.3 新特性全面解析
使用HTMX为WordPress增效:如何在不使用复杂框架的情况下增强平台功能
为React 19做准备:WordPress 6.6用户指南
如何删除WordPress中的所有评论

发布评论