Aykon

Oef2p24

Mar 8th, 2023
693
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.20 KB | None | 0 0
  1. //Business.cs
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace Oef2p24Omkeren
  9. {
  10.     class Business
  11.     {
  12.         private string naam;
  13.        
  14.         public string keerOm(string pinvoer)
  15.         {
  16.             string resultaat="";
  17.             for(int teller = pinvoer.Length-1; teller >= 0; teller--)
  18.             {
  19.                 resultaat += pinvoer[teller];
  20.             }
  21.             return resultaat;
  22.         }
  23.  
  24.         public string Naam
  25.         {
  26.             get { return naam; }
  27.             set { naam = value; }
  28.         }
  29.     }
  30. }
  31.  
  32. //Program.cs
  33. using System;
  34. using System.Collections.Generic;
  35. using System.Linq;
  36. using System.Text;
  37. using System.Threading.Tasks;
  38.  
  39. namespace Oef2p24Omkeren
  40. {
  41.     class Program
  42.     {
  43.         static void Main(string[] args)
  44.         {
  45.             Business rekenen = new Business();
  46.            
  47.             Console.WriteLine("Wat is de naam?");
  48.             rekenen.Naam = Console.ReadLine();
  49.  
  50.             Console.ForegroundColor = ConsoleColor.Green;
  51.             Console.WriteLine(rekenen.keerOm(rekenen.Naam));
  52.  
  53.             Console.ReadLine();
  54.         }
  55.     }
  56. }
  57.  
Advertisement
Add Comment
Please, Sign In to add comment