Advertisement
LePetitGlacon

FICHE 5 BASE Exercice 3

Oct 8th, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.77 KB | None | 0 0
  1. using System;
  2.  
  3. namespace p
  4. {
  5.     class Program
  6.     {
  7.         public static void Main(string[] args)
  8.         {
  9.             Console.WriteLine("Choisissez un nombre");
  10.             int nombre1 = int.Parse(Console.ReadLine());
  11.             int nombre2 = 0;
  12.             int compteur = 1;
  13.            
  14.             while (nombre1 > 20 || nombre1 < 0)
  15.             {
  16.                 if (nombre1 > 20)
  17.                 {
  18.                     Console.WriteLine("Le nombre est trop grand :)");
  19.                 }
  20.                 else
  21.                 {
  22.                     Console.WriteLine("nombre négatif !");
  23.                 }
  24.                 Console.WriteLine("Choisissez un nombre");
  25.                 nombre1 = int.Parse(Console.ReadLine());
  26.             }
  27.             Console.WriteLine("\n\nLe nombre est entre 0 et 20");
  28.             Console.ReadKey();
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement