sábado, 16 de marzo de 2013

Ejercicio de programación: 3

Enunciado: Leer un número entero y determinar si es negativo.

Código fuente en C: 

 
#include <stdio.h> 
#include <stdlib.h> 
  
int main(){ 
 int num; 
  
 printf("Ingrese un numero: "); 
 scanf("%d", &num); 
  
 if( num < 0 ){ 
  printf("El numero ingresado es negativo!\n"); 
 } 
 else{ 
  printf("El numero ingresado NO es negativo!\n"); 
 } 
  
 system("pause"); 
 return 0; 
} 

0 comentarios:

Publicar un comentario