Questions tagged [multiplication]

Multiplication is the mathematical operation of scaling one number by another. It is an elementary operation of most programming languages and is typically denoted by the symbol *.

Multiplication is the mathematical operation of scaling one number by another.

It is an elementary arithmetic operation in most programming languages along with addition, subtraction, division and sometimes modulo.

It is typically denoted by * (asterisk symbol) in programming, and × (cross symbol) in math.

Example (math): multiplication of numbers 3 and 4

3 × 4 = 12

See also: Multiplication on Wikipedia

2530 questions
0
votes
2 answers

the multiplication result is always zero because of pointers?

I am trying to write a program that takes two integers from the user and assigns them to pointers, and then passes those pointers to the function to multiply them and print the result. However the output is always 0. I'm a beginner and I'm failing…
gece
  • 3
  • 1
0
votes
3 answers

How do I make a summary and then multiply the result by group?

So this is my data frame. Country1 represent the people that live in Germany and Country 2 represent the country that they used to live 5 years before moving to Country1…
0
votes
0 answers

How can I write an efficient loop to solve this Code Wars problem?

The problem is the following: This is a problem taken from code wars and titled 'Is my friend cheating?' . A friend of mine takes a sequence of numbers from 1 to n (where n > 0). . Within that sequence, he chooses two numbers, a and b. . He says…
0
votes
1 answer

How can I multiply two sparse Matrix, without using numpy in Python?

I am new into programming and I am using for the first time stackoverflow so Hi to everyone! So, this is the reason why am I asking this: I am trying to multiply two sparse Matrix without numpy or other functions that might help me from python…
geekt
  • 1,979
  • 3
  • 10
  • 20
0
votes
3 answers

Multiplication Table PHP

I wanted to create a multiplication table with a custom function and also get the number of rows and columns from the user, and I want if each row was an even number then its field would be red (background) and if it was odd number it would have a…
Saman22
  • 21
  • 1
0
votes
1 answer

if i am taking A = 10^9 and B=10^9 than following code is giving negative output. why? It is giving me correct output for small integers

A and B are integers ranging from 1 to 10^9 , pairs is a variable that contain value of the expression ((A/2)(B/2)+((A-(A/2))(B-(B/2)))) #include using namespace std; int main() { int T; cin>>T; …
0
votes
1 answer

Pandas: rowwise multiplication of two dataframes

I have two dataframes; A contains allocation fractions and B contains hourly volumes. To get the right volume for each bus for a given hour, I need to multiply A with each row of dataframe B. For a given hour (x), this would be a simple…
Nesterion
  • 39
  • 1
  • 8
0
votes
1 answer

How do I multiply an element's tuple that I got from arg(*arg)? (Python 3)

So I'm a beginner in Python and I have this task. So, I have a tuple of random numbers, my job is to make a function that I can use to multiply these tuple of numbers, my mentor recommends me to use args (*args). ~ThankYou~
0
votes
3 answers

How to add header in Multiplication table using while loop c++

#include #include using namespace std; int main(){ int startAt = 1; int i = startAt; while (i <= 10){ int j = startAt; while (j <= 10) { cout<<"\t"<
0
votes
0 answers

SwiftUI - Element-wise multiplication of arrays

Why doesn't this code work for element-wise multiplication of two linear arrays? I've tried other similar setups but get the error: Binary operator '*' can not be applied to two 'Any' operators. What is an 'Any' operator? The app itself is to…
lulubasher
  • 41
  • 7
0
votes
1 answer

Egyptian multiplication algorithm complexity?

I do understand the algorithm but can't find a way to define its complexity, the only thing i know is it have something to with the second parameter, because if it was smaller the steps will be fewer. Do you have any idea how can i do this? and is…
Aymane Hrouch
  • 103
  • 1
  • 11
0
votes
1 answer

How to shorthand non-commutative multiplication?

Is there a shorthand to writing non-commutative variable multiplication in C++? For example with commutative variables we can do this: a = a * b; a *= b; // same as the above However with non-commutative variables, we can't: a = a * b; // #1 a =…
Jack Avante
  • 1,405
  • 1
  • 15
  • 32
0
votes
1 answer

if matrix values are below 0, multiply by

I have a vector p and a matrix Z. If values become negative in the first equation below, I would like to multiply them by a scaling factor sf. I have applied this for column 3 now, but my real data is a huge matrix, so how can I write an argument…
MoonS
  • 117
  • 7
0
votes
0 answers

What accounts for most of the integer multiply instructions?

The majority of integer multiplications don't actually need multiply: Floating-point is, and has been since the 486, normally handled by dedicated hardware. Multiplication by a constant, such as for scaling an array index by the size of the…
0
votes
2 answers

C# Function to return int.MinValue if the multiplication outcome value is too large

I am trying to write a function that returns the outcome of multiplying all the negative numbers in an array. If the value is too large to be handled, I want it to return the int.MinValue. I have coded this the following way, but it does not work…
user3755632
  • 381
  • 1
  • 2
  • 20