Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- static void Main(string[] args)
- {
- int heightInCm = 10;
- int widthInCm = 50;
- //Uitvoer 1 - rechthoek
- CalcAndShowArea(heightInCm, widthInCm);
- //Uitvoer 2 - vierkant
- CalcAndShowArea(heightInCm);
- }
- //berekening en output naar het scherm van rechthoek
- private static void CalcAndShowArea(int Zijde)
- {
- CalcAndShowArea(Zijde, Zijde);
- }
- //Berekening en output naar scherm van rechthoek
- private static void CalcAndShowArea(int Zijde1, int Zijde2)
- {
- int totalInCm = Zijde1 * Zijde2;
- string Answer = string.Format("Rechthoek met hoogte {0} en breedte {1} cm heeft een oppervlakte van {2} cm^2",
- Zijde1,
- Zijde2,
- totalInCm);
- Console.WriteLine(Answer);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement