ZeroSeventty

Multiply without math or multiply operator [C#]

Oct 23rd, 2020 (edited)
842
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7.  
  8. namespace program
  9. {
  10.     class multiply
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             Console.WriteLine(multiply(2,3));
  15.         }
  16.         public static int multiply(int x, int y){
  17.             int res = 0;
  18.             for(int i = 0; y>i; i++){
  19.                 res = res+x;
  20.             }
  21.             return res;
  22.         }
  23.     }
  24. }
  25.  
RAW Paste Data