Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program.cs
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Oef2Omkeren
- {
- class Program
- {
- static void Main(string[] args)
- {
- Business w1 = new Business();
- Console.WriteLine("Geef een woord");
- string naam = Console.ReadLine();
- Console.ForegroundColor = ConsoleColor.Blue;
- string output = w1.Omkeren(naam);
- Console.WriteLine(output);
- Console.WriteLine();
- if (output == naam)
- {
- Console.ForegroundColor = ConsoleColor.Cyan;
- Console.WriteLine("Je hebt een palindroom");
- }
- Console.ReadLine();
- }
- }
- }
- business.cs
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Oef2Omkeren
- {
- class Business
- {
- public string Omkeren(string pinvoer)
- {
- //return new string(pwoord.Reverse().ToArray());
- string resultaat = "";
- for (int teller = pinvoer.Length - 1; teller >= 0; teller--)
- {
- resultaat += pinvoer[teller];
- }
- return resultaat;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment