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 string_of_odd_numbers
- {
- class Program
- {
- static void Main(string[] args)
- {
- string s;
- char[,] box;
- Console.WriteLine("Enter the string of odd Numbers");
- s = Console.ReadLine();
- int length = s.Length;
- int central = length / 2;
- box = new char[length, length];
- for (int i = 0; i < s.Length; i++)
- {
- for (int j = 0; j < s.Length; j++)
- {
- if(i == central)
- {
- box[i, j] = s[j];
- }
- if(j == central)
- {
- box[i, j] = s[i];
- }
- if(i!=central && j !=central)
- {
- box[i, j] = 'X';
- }
- }
- }
- for (int l = 0; l < s.Length; l++)
- {
- for (int m = 0; m < s.Length; m++)
- {
- Console.Write(box[l,m]);
- }
- Console.WriteLine();
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment