Advertisement
LePetitGlacon

FICHE 6 Exercice 2

Nov 12th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.72 KB | None | 0 0
  1. using System;
  2.  
  3. namespace o
  4. {
  5.     class Program
  6.     {
  7.         public static void Main(string[] args)
  8.         {
  9.            
  10.           int[] tab10Valeurs = {25, 14, 50, 51,15, 14,13,12,18,18};
  11.             Console.WriteLine(" V ? ");
  12.             int V = int.Parse(Console.ReadLine());
  13.             bool oui = false;
  14.          
  15.           for (int i = 0;i < tab10Valeurs.Length;i++) {
  16.          
  17.             if (V == tab10Valeurs[i]){
  18.                     oui = true;
  19.             }
  20.           }
  21.             if (oui == true){
  22.                 Console.WriteLine(" Le nombre est dans la tableau ");
  23.             }
  24.             else{
  25.                 Console.WriteLine(" Le nombre n'est pas dans la tableau ");
  26.             }
  27.                
  28.             Console.ReadKey();
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement