PageRenderTime 56ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/King Xiong/Views/Home/Portfolio.cshtml

https://bitbucket.org/kingxiong/blogpostproject
Razor | 690 lines | 558 code | 79 blank | 53 comment | 38 complexity | 036460ea9a6a3cfff630243c9017c886 MD5 | raw file
  1. @{
  2. ViewBag.Title = "Portfolio";
  3. }
  4. <body>
  5. <section>
  6. <h2 class=" container section-heading text-center">Project Exercise</h2>
  7. <div class="container text-center">
  8. <div class="row">
  9. <div class="col-md-12 ">
  10. <h3>JavaScript Exercise</h3>
  11. <img src="~/Library/Template/img/5.jpg" class="btn page-scroll" data-toggle="modal" data-target="#series" title="5 Number Series" style="max-height:250px; max-width: 250px">
  12. <img src="~/Library/Template/img/Factorial.jpeg" class="btn page-scroll" data-toggle="modal" data-target="#factorialMod" title="Factorial" style="max-height:250px; max-width: 250px">
  13. <img src="~/Library/Template/img/FizzNBuzz.png" class="btn page-scroll" data-toggle="modal" data-target="#fizzbuzz" title="Fizz and Buzz" style="max-height:250px; max-width: 250px">
  14. <img src="~/Library/Template/img/Palindrome.png" class="btn page-scroll" data-toggle="modal" data-target="#palindrome" title="Palindrome" style="max-height:250px; max-width: 250px">
  15. <h3>C# Exercise</h3>
  16. <a href="" class="btn btn-primary btn-xl page-scroll btn-shape" data-toggle="modal" data-target="#cSeries" style="width:245.55px">5 Series of Numbers</a>
  17. <a href="" class="btn btn-primary btn-xl page-scroll btn-shape" data-toggle="modal" data-target="#cFactorial" style="width:245.55px">Factorial</a>
  18. <a href="" class="btn btn-primary btn-xl page-scroll btn-shape" data-toggle="modal" data-target="#cFizzBuzz" style="width:245.55px">Fizz and Buzz</a>
  19. <a href="" class="btn btn-primary btn-xl page-scroll btn-shape" data-toggle="modal" data-target="#cPalindrome" style="width:245.55px">Palindrome</a>
  20. </div>
  21. </div>
  22. </div>
  23. <br />
  24. </section>
  25. <!-- Modal for JS 5 Series program -->
  26. <div class="modal fade" id="series" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  27. <div class="modal-dialog modal-lg">
  28. <div class="modal-content">
  29. <div class="modal-header">
  30. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
  31. <h1 class="modal-title" id="myModalLabel"><font color="black">5 Series</font></h1>
  32. </div>
  33. <!--5 series Html Code for output-->
  34. <!-- class="modal-body col-*-*" is important for organization -->
  35. <div class="modal-body col-sm-12">
  36. <!--My functions-->
  37. <h4 style="color:black">Write a program that accepts a series of at least 5 numbers from the user and performs the follwing actions:</h4>
  38. <h4 style="color:black">a. Determine which number is the least</h4>
  39. <h4 style="color:black">b. Determine which number is the greatest</h4>
  40. <h4 style="color:black">c. Determine the mean of the numbers</h4>
  41. <h4 style="color:black">d. Determine the sum of all the numbers</h4>
  42. <h4 style="color:black">e. Determine the product of all the numbers</h4>
  43. <div class="row">
  44. <!--Rows before Column-->
  45. <div class="col-md-2">
  46. <!--Trying to config two columns, 1 column is for input(submitting numbers), the other is for output(result)-->
  47. <form>
  48. <!--Form tag is for boxes to input materials-->
  49. <div class="form-group">
  50. <!--Form-group is to group all the labels & input into each separate row (only for bootstrap)-->
  51. <input type="number" id="firstNumber" name="firstNumber" class="form-control" placeholder="First Number" />
  52. <!--Form-control enables the uses of bootstrap--><!--id="firstNumber" is unique-->
  53. </div>
  54. <div class="form-group">
  55. <input type="number" id="secondNumber" name="secondNumber" class="form-control" placeholder="Second Number" />
  56. <!--id="secondNumber" is unique-->
  57. </div>
  58. <div class="form-group">
  59. <input type="number" id="thirdNumber" name="thirdNumber" class="form-control" placeholder="Third Number" />
  60. <!--id="thirdNumber" is unique-->
  61. </div>
  62. <div class="form-group">
  63. <input type="number" id="fourthNumber" name="fourthNumber" class="form-control" placeholder="Fourth Number" />
  64. <!--id="fourthNumber" is unique-->
  65. </div>
  66. <div class="form-group">
  67. <input type="number" id="fifthNumber" name="fifthNumber" class="form-control" placeholder="Fifth Number" />
  68. <!--id="fifthNumber" is unique-->
  69. </div>
  70. </form>
  71. <button id="calculate" type="submit" class="btn btn-block" value="Run">Calculate</button>
  72. <!--id="calculate" is unique in HTML-->
  73. </div>
  74. <div class="col-md-2">
  75. <!--The second column with width of 6-->
  76. <div class="form-group">
  77. <label>Least:</label>
  78. <label id="least"></label>
  79. </div>
  80. <div class="form-group">
  81. <label>Greatest:</label>
  82. <label id="greatest"></label>
  83. </div>
  84. <div class="form-group">
  85. <label>Mean:</label>
  86. <label id="mean"></label>
  87. </div>
  88. <div class="form-group">
  89. <label>Sum:</label>
  90. <label id="sum"></label>
  91. </div>
  92. <div class="form-group">
  93. <label>Product:</label>
  94. <label id="product"></label>
  95. </div>
  96. </div>
  97. <div class="col-md-8">
  98. <pre class="brush: js">
  99. $(document).ready(function () {
  100. $("#calculate").click(function (event) {
  101. event.preventDefault();
  102. });
  103. });
  104. $("#calculate").click(calculateNumbers);
  105. function calculateNumbers() {
  106. //input
  107. var firstValue = parseInt($("#firstNumber").val());
  108. //parseInt is converting input as an integer value instead of a text value
  109. var secondValue = parseInt($("#secondNumber").val());
  110. // $("#secondNumber") is using jquery to test if id="secondNumber" is a integer value.
  111. var thirdValue = parseInt($("#thirdNumber").val());
  112. var fourthValue = parseInt($("#fourthNumber").val());
  113. var fifthValue = parseInt($("#fifthNumber").val());
  114. //Processing
  115. //inputing the variable min to be Math.min( , , , , )
  116. //min
  117. var min = Math.min(firstValue, secondValue, thirdValue, fourthValue, fifthValue);
  118. //max
  119. var max = Math.max(firstValue, secondValue, thirdValue, fourthValue, fifthValue);
  120. //sum
  121. var add = firstValue + secondValue + thirdValue + fourthValue + fifthValue;
  122. //product
  123. var numArray = [firstValue, secondValue, thirdValue, fourthValue, fifthValue];
  124. var multiplication = 1;
  125. for (i = 0; i < numArray.length; i++)
  126. {
  127. multiplication *= numArray[i];
  128. }
  129. /* Simplier version
  130. var multiplication = firstValue * secondValue * thirdValue * fourthValue * fifthValue;
  131. */
  132. //mean
  133. var mean = add / numArray.length;
  134. //output
  135. $("#least").html(min);
  136. $("#greatest").html(max);
  137. $("#mean").html(mean);
  138. $("#sum").html(add);
  139. // id="sum" exist in HTML, but .html(add) exist in var add in JavaScript
  140. $("#product").html(multiplication);
  141. };
  142. </pre>
  143. </div>
  144. </div>
  145. <!--End of 5 series function -->
  146. </div>
  147. <div class="modal-footer no-margin">
  148. </div>
  149. </div>
  150. </div>
  151. </div>
  152. <!--End of Modal for 5 Series exercise-->
  153. <!-- Modal for JS Factorial project -->
  154. <div class="modal fade" id="factorialMod" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  155. <div class="modal-dialog modal-lg">
  156. <div class="modal-content">
  157. <div class="modal-header">
  158. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
  159. <h1 class="modal-title" id="myModalLabel"><font color="black">Factorial</font></h1>
  160. </div>
  161. <!--Factorial Html Code for output-->
  162. <div class="modal-body col-sm-12">
  163. <div class="row" style="color:black">
  164. <div class="col-lg-2">
  165. <h2>Input your number</h2>
  166. <form>
  167. <div class="form-group">
  168. <input type="number" id="factorialNumber" name="factorialNumber" class="form-control" placeholder="Number" />
  169. <button id="factorialCalculate" type="submit" class="btn btn-block">Calculate</button>
  170. </div>
  171. </form>
  172. </div>
  173. <div class="col-lg-2">
  174. <label>Factorial:</label><br />
  175. <label id="factorial"></label>
  176. </div>
  177. <div class="col-lg-8">
  178. <pre class="brush: js">
  179. $(document).ready(function () {
  180. $("#factorialCalculate").click(function (event) {
  181. event.preventDefault();
  182. });
  183. });
  184. $("#factorialCalculate").click(calculateFactorial);
  185. function calculateFactorial() {
  186. //input variables
  187. var factorialFunction = 1;
  188. var inputNum = parseInt($("#factorialNumber").val());
  189. //process
  190. for (i = inputNum; i > 0; i--) {
  191. factorialFunction *= i;
  192. }
  193. //output
  194. $("#factOutput").html(factorialFunction);
  195. }
  196. </pre>
  197. </div>
  198. </div>
  199. </div>
  200. <!--End of 5 series function -->
  201. <div class="modal-footer no-margin">
  202. </div>
  203. </div>
  204. </div>
  205. </div>
  206. <!-- End of modal for Factorial exercise -->
  207. <!-- Modal for JS Fizz and Buzz-->
  208. <div class="modal fade" id="fizzbuzz" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  209. <div class="modal-dialog modal-lg">
  210. <div class="modal-content">
  211. <div class="modal-header">
  212. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
  213. <h1 class="modal-title" id="myModalLabel"><font color="black">Fizz and Buzz</font></h1>
  214. </div>
  215. <!--Fizz and Buzz Html Code for output-->
  216. <div class="modal-body col-sm-12">
  217. <div class="row" style="color:black">
  218. <div class="col-lg-3">
  219. <h1>Fizz And Buzz</h1>
  220. <form>
  221. <div class="form-group">
  222. <input type="number" min="1" max="100" id="first" class="form-control" placeholder="Enter the first number" />
  223. <input type="number" min="1" max="100" id="second" class="form-control" placeholder="Enter the second number" />
  224. <button id="solve" type="submit" class="btn btn-block">Solve</button>
  225. </div>
  226. </form>
  227. </div>
  228. <div class="col-lg-2" id="answers-scroll">
  229. <label>Result:</label><br />
  230. <label id="result"></label>
  231. </div>
  232. <div class="col-lg-7">
  233. <pre class="brush: js">
  234. $(document).ready(function () {
  235. $("#solve").click(function (event) {
  236. event.preventDefault();
  237. });
  238. });
  239. $("#solve").click(computing);
  240. function computing() {
  241. var inputOne = parseInt($("#first").val());
  242. var inputTwo = parseInt($("#second").val());
  243. var numArray = [];
  244. ////adding 1-100 into numArray
  245. for (i = 1; i <= 100; i++)
  246. {
  247. numArray.push(i);
  248. }
  249. //indexing
  250. for (j = 0; j < 100; j++)
  251. {
  252. if (numArray[j] % inputOne === 0 && numArray[j] % inputTwo === 0) {
  253. $("#result").append("Fizz&Buzz");
  254. }
  255. else if (numArray[j] % inputOne === 0) {
  256. $("#result").append("Fizz");
  257. }
  258. else if (numArray[j] % inputTwo === 0) {
  259. $("#result").append("Buzz");
  260. } else {
  261. $("#result").append(numArray[j]);
  262. }
  263. $("#result").append("<br>")
  264. }
  265. };
  266. </pre>
  267. </div>
  268. </div>
  269. </div>
  270. <!--End of Fizz and Buzz function -->
  271. <div class="modal-footer no-margin">
  272. </div>
  273. </div>
  274. </div>
  275. </div>
  276. <!-- End of modal for Fizz And Buzz exercise -->
  277. <!-- Modal for JS Palindrome-->
  278. <div class="modal fade" id="palindrome" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  279. <div class="modal-dialog modal-lg">
  280. <div class="modal-content">
  281. <div class="modal-header">
  282. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
  283. <h1 class="modal-title" id="myModalLabel"><font color="black">Palindrome</font></h1>
  284. </div>
  285. <!-- Palindrome Html Code for output-->
  286. <div class="modal-body col-sm-12">
  287. <div class="row" style="color:black">
  288. <div class="col-lg-5">
  289. <h2>Please enter a word.</h2>
  290. <h2>This program will check if it is a Palindrome word.</h2>
  291. <form>
  292. <div class="form-group">
  293. <!--form-group groups anything in forms into separate boxes-->
  294. <input type="text" id="inputWord" class="form-control" placeholder="Palindrome Word" />
  295. <button id="confirmPal" type="submit" class="btn btn-block">Solve</button>
  296. </div>
  297. </form>
  298. <div>
  299. <label>Outcome:</label>
  300. <label id="outcome"></label>
  301. </div>
  302. <!-- End of Palindrome function -->
  303. </div>
  304. <div class="col-lg-7">
  305. <pre class="brush: js">
  306. $(document).ready(function () {
  307. $("#confirmPal").click(function (event) {
  308. event.preventDefault();
  309. });
  310. });
  311. $("#confirmPal").click(computing);
  312. function computing() {
  313. //declares variable input
  314. //.val() is a method in jQuery used to put value in an object.
  315. var inputWord = $("#inputWord").val();
  316. var theText = [];
  317. //computing the results
  318. for (j = 0; j <= inputWord.length - 1; j++) {
  319. //setting the array theText to be the same as each individual character from the inputed word.
  320. theText[j] = inputWord.charAt(j);
  321. }
  322. theText.reverse();
  323. //theText.reverse() converts the inputed word around
  324. var oppText = theText.join("");
  325. //oppText changes the theText.join("") into the array with no commas in between
  326. //example (["a","f","t","e","r"] ==> "after")
  327. //output
  328. if (inputWord === oppText) {
  329. $("#outcome").html("It is a palindrome");
  330. } else if (theText !== oppText) {
  331. $("#outcome").html("It is not a palindrome");
  332. }
  333. }
  334. </pre>
  335. </div>
  336. </div>
  337. </div>
  338. <div class="modal-footer no-margin">
  339. </div>
  340. </div>
  341. </div>
  342. </div>
  343. <!-- End of modal for Palindrome exercise -->
  344. <!-- C# modal for 5 Series -->
  345. <div class="modal fade" id="cSeries" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  346. <div class="modal-dialog modal-lg">
  347. <div class="modal-content">
  348. <div class="modal-header">
  349. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
  350. <h1 class="modal-title" id="myModalLabel"><font color="black">5 Series C#</font></h1>
  351. </div>
  352. <!--5 series C# code-->
  353. <div class="modal-body col-sm-12">
  354. <!--My functions-->
  355. <h4 style="color:black">Write a program that accepts a series of at least 5 numbers from the user and performs the follwing actions:</h4>
  356. <h4 style="color:black">a. Determine which number is the least</h4>
  357. <h4 style="color:black">b. Determine which number is the greatest</h4>
  358. <h4 style="color:black">c. Determine the mean of the numbers</h4>
  359. <h4 style="color:black">d. Determine the sum of all the numbers</h4>
  360. <h4 style="color:black">e. Determine the product of all the numbers</h4>
  361. <div class="row">
  362. <!--Rows before Column-->
  363. <div class="col-md-12">
  364. <pre class="brush: csharp">
  365. using System;
  366. using System.Collections.Generic;
  367. using System.Linq;
  368. using System.Text;
  369. using System.Threading.Tasks;
  370. namespace _5_Series
  371. {
  372. class Program
  373. {
  374. static void Main(string[] args)
  375. {
  376. double first, second, third, fourth, fifth, minNumber, maxNumber, sum, product, mean;
  377. string firstInput, secondInput, thirdInput, fourthInput, fifthInput;
  378. Console.WriteLine("Enter your first number");
  379. firstInput = Console.ReadLine();
  380. first = double.Parse(firstInput);
  381. Console.WriteLine("Enter your second number");
  382. secondInput = Console.ReadLine();
  383. second = double.Parse(secondInput);
  384. Console.WriteLine("Enter your third number");
  385. thirdInput = Console.ReadLine();
  386. third = double.Parse(thirdInput);
  387. Console.WriteLine("Enter your fourth number");
  388. fourthInput = Console.ReadLine();
  389. fourth = double.Parse(fourthInput);
  390. Console.WriteLine("Enter your fifth number");
  391. fifthInput = Console.ReadLine();
  392. fifth = double.Parse(fifthInput);
  393. double[] numberArray = { first, second, third, fourth, fifth };
  394. maxNumber = numberArray.Max();
  395. minNumber = numberArray.Min();
  396. sum = first + second + third + fourth + fifth;
  397. product = first * second * third * fourth * fifth;
  398. mean = sum / numberArray.Length;
  399. Console.WriteLine("Max " + maxNumber);
  400. Console.WriteLine("Min " + minNumber);
  401. Console.WriteLine("Sum " + sum);
  402. Console.WriteLine("Product " + product);
  403. Console.WriteLine("Mean " + mean);
  404. Console.ReadKey();
  405. }
  406. }
  407. }
  408. </pre>
  409. </div>
  410. </div>
  411. <!--End of 5 series function -->
  412. </div>
  413. <div class="modal-footer no-margin">
  414. </div>
  415. </div>
  416. </div>
  417. </div>
  418. <!-- End of C# modal for 5 Series -->
  419. <!-- C# modal for Factorial -->
  420. <div class="modal fade" id="cFactorial" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  421. <div class="modal-dialog modal-lg">
  422. <div class="modal-content">
  423. <div class="modal-header">
  424. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
  425. <h1 class="modal-title" id="myModalLabel"><font color="black">Factorial C#</font></h1>
  426. </div>
  427. <!--Factorial C# code-->
  428. <div class="modal-body col-sm-12">
  429. <!--My functions-->
  430. <h4 style="color:black">
  431. Write a program that calculates the factorial of a number. The factorial of a non-negative integer <em>n</em>
  432. is the product of all positive integers less than or equal to <em>n</em>. (i.e. 5! = 5 x 4 x 3 x 2 x 1 = 120)
  433. </h4>
  434. <div class="row">
  435. <!--Rows before Column-->
  436. <div class="col-md-12">
  437. <pre class="brush: csharp">
  438. using System;
  439. using System.Collections.Generic;
  440. using System.Linq;
  441. using System.Text;
  442. using System.Threading.Tasks;
  443. namespace Factorial_cSharp
  444. {
  445. class Program
  446. {
  447. static void Main(string[] args)
  448. {
  449. int factorialNumber;
  450. int factorialResult = 1;
  451. string facNumInput;
  452. Console.WriteLine("Enter your factorial number");
  453. facNumInput = Console.ReadLine();
  454. factorialNumber = int.Parse(facNumInput);
  455. for (int i = factorialNumber; i > 0; i--)
  456. {
  457. factorialResult *= i;
  458. }
  459. Console.WriteLine("Factorial Number is " + factorialResult);
  460. Console.ReadKey();
  461. }
  462. }
  463. }
  464. </pre>
  465. </div>
  466. </div>
  467. <!--End of Factorial function -->
  468. </div>
  469. <div class="modal-footer no-margin">
  470. </div>
  471. </div>
  472. </div>
  473. </div>
  474. <!-- End of C# modal for Factorial -->
  475. <!--C# modal for FizzBuzz-->
  476. <div class="modal fade" id="cFizzBuzz" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  477. <div class="modal-dialog modal-lg">
  478. <div class="modal-content">
  479. <div class="modal-header">
  480. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
  481. <h1 class="modal-title" id="myModalLabel"><font color="black">Fizz and Buzz C#</font></h1>
  482. </div>
  483. <!--FizzBuzz C# code-->
  484. <div class="modal-body col-sm-12">
  485. <!--My functions-->
  486. <h4 style="color:black">
  487. Write a program that accepts two numbers between 1 and 100 from the user. The program then iterates
  488. through all numbers from 1 to 100, printing numbers in ascending order to the screen. For each number
  489. that is a multiple of the first number input by the user, print "Fizz" instead of the number. For each
  490. number that is a multiple of the second number input by the user, print "Buzz" instead of the number.
  491. For numbers that are multiples of both numbers, print "FizzBuzz" instead of the number.
  492. </h4>
  493. <div class="row">
  494. <!--Rows before Column-->
  495. <div class="col-md-12">
  496. <pre class="brush: csharp">
  497. using System;
  498. using System.Collections.Generic;
  499. using System.Linq;
  500. using System.Text;
  501. using System.Threading.Tasks;
  502. namespace FizzAndBuzz_cSharp
  503. {
  504. class Program
  505. {
  506. static void Main(string[] args)
  507. {
  508. int fbOne, fbTwo;
  509. string oneInput, twoInput;
  510. int[] fbArray = new int [101];
  511. Console.WriteLine("Enter the first number");
  512. oneInput = Console.ReadLine();
  513. fbOne = int.Parse(oneInput);
  514. Console.WriteLine("Enter the second number");
  515. twoInput = Console.ReadLine();
  516. fbTwo = int.Parse(twoInput);
  517. for (int i = 0; i < 100; i++)
  518. {
  519. fbArray[i] = i;
  520. }
  521. Console.WriteLine("Result: ");
  522. for (int j = 1; j <= 100; j++)
  523. {
  524. if (fbArray[j] % fbOne == 0 && fbArray[j] % fbTwo == 0)
  525. Console.WriteLine("Fizz Buzz");
  526. else if (fbArray[j] % fbOne == 0)
  527. Console.WriteLine("Fizz");
  528. else if (fbArray[j] % fbTwo == 0)
  529. Console.WriteLine("Buzz");
  530. else
  531. Console.WriteLine(j);
  532. }
  533. Console.ReadKey();
  534. }
  535. }
  536. }
  537. </pre>
  538. </div>
  539. </div>
  540. <!--End of FizzBuzz function -->
  541. </div>
  542. <div class="modal-footer no-margin">
  543. </div>
  544. </div>
  545. </div>
  546. </div>
  547. <!-- End of C# modal for FizzBuzz -->
  548. <!-- C# modal for Palindrome -->
  549. <div class="modal fade" id="cPalindrome" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  550. <div class="modal-dialog modal-lg">
  551. <div class="modal-content">
  552. <div class="modal-header">
  553. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
  554. <h1 class="modal-title" id="myModalLabel"><font color="black">Palindrome C#</font></h1>
  555. </div>
  556. <!--Palindrome C# code-->
  557. <div class="modal-body col-sm-12">
  558. <!--My functions-->
  559. <h4 style="color:black">
  560. Write a program that determines whether a word is a Palindrome (the same backward as
  561. it is forward - "radar" for example). Display the result to the user.
  562. </h4>
  563. <div class="row">
  564. <!--Rows before Column-->
  565. <div class="col-md-12">
  566. <pre class="brush: csharp">
  567. using System;
  568. using System.Collections.Generic;
  569. using System.Linq;
  570. using System.Text;
  571. using System.Threading.Tasks;
  572. namespace Palindrome_cSharp
  573. {
  574. class Program
  575. {
  576. static void Main(string[] args)
  577. {
  578. Console.WriteLine("Enter your Palindrome Word");
  579. string inputText = Console.ReadLine();
  580. int textLength = inputText.Length;
  581. //arrText is an array that stores each individual characters in each individual slot
  582. char[] arrText = inputText.ToCharArray();
  583. //bool isPalindrome = true;
  584. // RADAR
  585. for (int i = 0; i < textLength; i++)
  586. {
  587. if (arrText[i] != arrText[textLength - i - 1])
  588. {
  589. Console.WriteLine("Not Palindrome");
  590. i = textLength;
  591. }
  592. if(i == textLength-1 && arrText[i] == arrText[textLength - i - 1])
  593. {
  594. Console.WriteLine("Palindrome");
  595. }
  596. }
  597. Console.ReadKey();
  598. }
  599. }
  600. }
  601. </pre>
  602. </div>
  603. </div>
  604. <!--End of Palindrome function -->
  605. </div>
  606. <div class="modal-footer no-margin">
  607. </div>
  608. </div>
  609. </div>
  610. </div>
  611. </body>