Computer Science, asked by addyrocks1094, 11 months ago

write a program to check whether in int type number taken as input is a positive, negative or zero

Answers

Answered by BrainlyTech
8

Hello Friend!

I'm here to help you with a program.

So I am going to write the program you want.

This is a small code so it won't take forever.

I've answered a question similar to this.

So lets get started!

#include <stdio.h>

 void main()

{

   int num;

 

   printf("Enter any number: \n");

   scanf("%d", &num);

   if (num > 0)

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

   else if (num < 0)

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

   else

       printf("0 is neither positive nor negative");

}

\textbf{ Hope this helps you! }

\textbf{ If not let me know! }

\textbf{ Have a good day my friend! }

\boxed{ Remember To Be Brainly! }


addyrocks1094: thanks
BrainlyTech: No Problem!
addyrocks1094: yeah
Answered by CopyThat
2

JAVA:-

.

import java.util.*;

class Q3

{

static void main()

{

int n;

Scanner sc=new Scanner(System.in);

System.out.println(“Enter a number:”);

n=sc.nextInt();

if(n>0)

System.out.println(“Positive”);

else if(n<0)

System.out.println(“Negative”);

else

System.out.println(“Zero”);

}

Similar questions