Login to ask a question from C Programs on integers

C Program to Check if a given Integer is Positive or Negative:

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

Problem Description

The program takes the given integer and checks whether the integer is positive or negative.

Problem Solution

  • Take the integer which you want to check as input.

  • Check if it is greater or lesser than zero and print the output accordingly.

  • Exit.

Program/Source Code

#include

 

void main()

{

    int number;

 

    printf("Enter a number \n");

    scanf("%d", &number);

    if (number >= 0)

        printf("%d is a positive number \n", number);

    else

        printf("%d is a ne....

Show More
Previous Question Next Question
🔗

Similar Questions

From C Programs on integers · C programming

View All
WhatsApp