Advertisement
LePetitGlacon

FICHE 6 Exercice 3

Nov 12th, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.71 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.                     Console.WriteLine(" Le nombre est dans la tableau Γ  l'indice {0}", i);
  19.                     oui = true;
  20.             }
  21.           }
  22.             if (oui == false){
  23.                 Console.WriteLine(" Le nombre n'est pas dans la tableau ");
  24.             }
  25.                
  26.             Console.ReadKey();
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement