Advertisement
Guest User

Cetvrti zad 2 grupa

a guest
Nov 11th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Zad4
  8. {
  9. class Program
  10. {
  11. static int Stepen(int broj, int stepen)
  12. {
  13. int c = 1;
  14. for (int i = 0; i < stepen; i++)
  15. {
  16. c*= broj;
  17. }
  18. return c;
  19. }
  20. static double Stepen(double broj, int stepen)
  21. {
  22. double k = 1;
  23. for (int i = 0; i < stepen; i++)
  24. {
  25. k *= broj;
  26. }
  27. return k;
  28. }
  29. static void Main(string[] args)
  30. {
  31. int br1;
  32. double br2;
  33. br1 = Stepen(5, 2);
  34. br2 = Stepen(2.5, 2);
  35. Console.WriteLine(br1);
  36. Console.WriteLine(br2);
  37. Console.ReadKey();
  38. }
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement