ALGORITMO QUE MUESTRE SI UN NÚMERO ES POSITIVO, NEGATIVO O NULO

Categoría de Estructura Condicional Anidada


Algoritmo para saber si un número es positivo o negativo

💻 Hacer un programa que permita ingresar un número entero y muestre si es un número positivo [ Mayor que Cero], negativo [Menor que cero ] o nulo [ Igual a Cero ].


Algoritmo en pseint que muestre positivo, negativo o nulo PSeInt Estricto : DESCARGA EL CÓDIGO

algoritmo que calcule el IGV

Algoritmo en pseint - short youtube
Algoritmo programacion_work
    // Muestra número positivo o negativo
    
    Definir num como Entero;	
    Escribir Sin Saltar "INGRESE NÚMERO : ";
    Leer num;	
    SI (num == 0) Entonces
        Escribir "NÚMERO NULO o CERO";
    SiNo
        SI (num > 0) Entonces
            Escribir "NÚMERO POSITIVO";
        SiNo
            Escribir "NÚMERO NEGATIVO";
        FinSi
    FinSi
    
FinAlgoritmo
Algoritmo en pseint que muestre positivo, negativo o nulo

código en python que muestra si es positivo, negativo o nulo Python :

# 03. MOSTRAR SI ES POSITIVO, NEGATIVO O NULO
num = int(input("INGRESE NÚMERO : "))
if num == 0:
    print("NÚMERO NULO o CERO")
elif num > 0 :
    print("NÚMERO POSITIVO")
else:
    print("NÚMERO NEGATIVO")

código en Lenguaje C que muestra número positivo, negativo o nulo Lenguaje C :

#include<stdio.h>
int main() {
    int num;
    printf("03. NUMERO POSITIVO, NEGATIVO O NULO.\n\n");    
    printf("INGRESE NUMERO : ");    
    scanf("%d",&num); 
    if(num == 0){
        printf("\nNUMERO NULO o CERO");
    }else{
        if(num > 0){
            printf("\nNUMERO POSITIVO");
        }else{
            printf("\nNUMERO NEGATIVO");
        }
    }        
    return 0;
}

código en Dev C++ que indique si un número es positivo o negativo Dev C++ :

#include<iostream>
using namespace std;
int main() {
    int num;
    cout << "INGRESE NUMERO : ";
    cin >> num;		
    if(num == 0){
        cout << "NUMERO NULO o CERO" << endl;	
    }else{
        if(num > 0){
            cout << "NUMERO POSITIVO" << endl;	
        }else{			
            cout << "NUMERO NEGATIVO" << endl;				
        }	
    }
    return 0;
}

Programar en Java NetBeans para mostrar si el número es mayor que cero, menor que cero o igual a cero Java NetBeans :

package programacion_work;
import java.util.Scanner;
public class positivo_negativo_nulo {
    public static void main(String[] args) {        
        int num;      
        Scanner ingreso=new Scanner(System.in);
        System.out.print("INGRESE NUMERO : ");
        num = Integer.parseInt(ingreso.next());
        if(num == 0){
            System.out.println("NUMERO NULO o CERO");	
        }else{
            if(num > 0){
                System.out.println("NUMERO POSITIVO");	
            }else{
                System.out.println("NUMERO NEGATIVO");
            }	
        }	
    }       
}



Facebook de www.programacion.work. Canal de Youtube de www.programacion.work. Twitter de www.programacion.work. TikTok de www.programacion.work.


Política de cookies

Política de Privacidad

Aviso Legal y Términos De Uso