Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- static int Citire()
- {
- int rez = 0, c;
- c = Console.Read();
- while (c != 32 && c != 13)
- {
- rez = rez * 10 + (c - 48);
- c = Console.Read();
- }
- return rez;
- }
- static void Main(string[] args)
- {
- int n = 0, k = 0, x = 0;
- int[] v = new int[1000];
- n = Convert.ToInt32(Console.ReadLine());
- for (int i = 1; i <= n; i++)
- v[i] = Citire();
- Console.ReadLine();
- k = Convert.ToInt32(Console.ReadLine());
- x = Convert.ToInt32(Console.ReadLine());
- if (k <= n)
- {
- for (int i = n; i >= k; i--)
- v[i + 1] = v[i];
- v[k] = x;
- n++;
- for (int i = 1; i <= n; i++)
- Console.Write(v[i] + " ");
- }
- else
- Console.WriteLine("pozitie depasita\nlungime vector=" + n);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement