Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Task_1._3
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Input number a: ");
- string a = Console.ReadLine();
- int w = 0;
- int z = 10;
- int[] b = new int[a.Length];
- for (int i = 0; i < a.Length; i++)
- {
- b[i] = Convert.ToInt32(a.Substring(i, 1));
- w = w + b[i] * z;
- z--;
- }
- int x;
- if (w % 11 != 0)
- {
- x = (w / 11 + 1) * 11 - w;
- }
- else
- {
- x = 0;
- }
- if (x == 10)
- { Console.WriteLine(a + 'X'); }
- else
- {
- Console.WriteLine(a + x);
- }
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement