Advertisement
Guest User

consolevierkant

a guest
Oct 18th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. class Program
  2. {
  3.  
  4. static void Main(string[] args)
  5. {
  6. int heightInCm = 10;
  7. int widthInCm = 50;
  8. //Uitvoer 1 - rechthoek
  9. CalcAndShowArea(heightInCm, widthInCm);
  10. //Uitvoer 2 - vierkant
  11. CalcAndShowArea(heightInCm);
  12. }
  13. //berekening en output naar het scherm van rechthoek
  14. private static void CalcAndShowArea(int Zijde)
  15. {
  16. CalcAndShowArea(Zijde, Zijde);
  17. }
  18. //Berekening en output naar scherm van rechthoek
  19. private static void CalcAndShowArea(int Zijde1, int Zijde2)
  20. {
  21.  
  22. int totalInCm = Zijde1 * Zijde2;
  23.  
  24. string Answer = string.Format("Rechthoek met hoogte {0} en breedte {1} cm heeft een oppervlakte van {2} cm^2",
  25. Zijde1,
  26. Zijde2,
  27. totalInCm);
  28.  
  29. Console.WriteLine(Answer);
  30. Console.ReadKey();
  31. }
  32.  
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement