Log in

View Full Version : [SOLVED:] Javascript to VB



DimTim
01-11-2017, 04:35 PM
Can somebody help me convert this to VB?
I need to multiply two numbers together without using *



System.out.println("Enter the first number");
BufferedReader obj =newBufferedReader(newInputStreamReader((System.in)));
int a=Integer.parseInt(obj.readLine());
System.out.println("Enter the Second number");
int b=Integer.parseInt(obj.readLine());
int c=0;
for(int i=0;i<b;i++){
c=c+a;
}
System.out.println("The Product is"+c);
}

DimTim
01-11-2017, 07:15 PM
I believe I got it!

'Dim intinput1 As Integer
'Dim intinput2 As Integer
'Dim inttotal As Integer


'intinput1 = 10
'intinput2 = 4


'Dim intcount As Integer = 0


'Do Until intcount = intinput2
' intcount += 1
' inttotal = inttotal + intinput1
'Loop


'MessageBox.Show(inttotal)

SamT
01-11-2017, 08:53 PM
Total = Input1 * Input2

DimTim
01-12-2017, 05:02 AM
Total = Input1 * Input2

I had to solve this problem without using *. Although it was the first choice for me as well.

SamT
01-12-2017, 10:30 AM
My bad, I totally missed the * in the requirements.

Glad you didn't :D