Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.11 KB | None | 0 0
  1. using System;
  2.  
  3. namespace f6._
  4. {
  5.     class Program
  6.     {
  7.         public static void Main(string[] args)
  8.         {
  9.            
  10.             /* Programme insérant V à un indice I et qui décale vers la droite (en direction des indices montant) les valeurs. La dernière valeur est perdue */
  11.            
  12.             int[] tabEntier =  { 14, 28, 32, 16, 14, 15, 8, 9, 7, 6, 48, 20, 1, 0, 91, 15 };
  13.            
  14.             Console.WriteLine("V ?");
  15.             int V = int.Parse(Console.ReadLine());
  16.            
  17.             Console.WriteLine("I ?");
  18.             int I = int.Parse(Console.ReadLine());
  19.            
  20.             int[] tabTemp = { 14, 28, 32, 16, 14, 15, 8, 9, 7, 6, 48, 20, 1, 0, 91, 15 };
  21.            
  22.             for(int j = I; j > 0 ; j--){
  23.                
  24.                 tabEntier[j - 1] = tabTemp[j];
  25.             }
  26.            
  27.            
  28.             tabEntier[I] = V;
  29.            
  30.             foreach(int a in tabEntier){
  31.                
  32.                 Console.WriteLine(a);
  33.             }
  34.            
  35.             Console.ReadKey(true);
  36.            
  37.        
  38.          }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement