It is pretty easy to multiple two integers using repeated addition. However it’s a bit difficult to extend the same logic for floating point numbers. The easiest way to perform multiplication without using the ‘*’ sign is to do a division.
package com.twister;
public class Multiply{
public static void main(String args[]){
float num1 = 20.5f;
float num2 = 2.0f;
float product = num1/(1.0f/num2);
System.out.println("The product of the Numbers is : "+product);
}
}
Sorry no correct answers this week!
as i guess it is 41.0
ReplyDeletei run your code if there is any twist again it is 41.0
nsureshreddy@live.com