Pages

Exercice N°3 de base "positif" ou "négatif"

dimanche 10 novembre 2013


Exercice N°3 de base


Ecrivez un programme qui affiche "positif" ou "négatif" ou "null" en fonction d'un nombre donné.Exemple:
Entrée: a=-6
Sortie: -6 est négatif

Le code Source :


 1 #include<stdio.h>
 2  #include<conio.h>
 3  int main()
 4  {
 5     int n;
 6     printf("Entree un nombre : ");
 7     scanf("%d",&n);
 8  
 9     if(n>0)
10     printf("%d est positif",n);
11     else if(n==0)
12     printf("%d est NULL",n);
13     else
14     printf("%d est negatif",n
15     );
17  getch();
18  }
Telecharger le fichier ".exe" ICI
 

Most Reading

Stats