Foibs

methodos pou epistrefei arithmo kai dynamh

Dec 3rd, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.61 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp1
  4. {
  5.     class Program
  6.     {
  7.         static int powah(int x, int y)
  8.         {
  9.             int result = 1;
  10.  
  11.             for (int i=0; i<y; i++)
  12.             {
  13.                 result *= x;
  14.             }
  15.  
  16.             return result;
  17.         }
  18.  
  19.         static void Main(string[] args)
  20.         {
  21.  
  22.             Console.WriteLine("Dwse arithmo kai dynamh");
  23.             int arithmos = int.Parse(Console.ReadLine());
  24.             int dynamh = int.Parse(Console.ReadLine());
  25.             Console.WriteLine("To apotelesma einai: " + powah(arithmos, dynamh));
  26.  
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment