Questions tagged [operation]
734 questions
-2
votes
1 answer
using power operation "**" and multiple multiplications in Fortran
Which one do you think if the faster operation in Fortran?
x**2 VS x*x
x**3 VS x*x*x
x**4 VS x*x*x*x
x**5 VS x*x*x*x*x

user2008151314
- 680
- 6
- 10
-2
votes
2 answers
Array == double equal,
I got an array implode variable, $varString, that is setup to return 3 separate values listed below depending on the condition.
1
2
1,2
If ($varString == 1)
{
echo 'APPLE';}
ElseIf ($varString == 2)
{
echo 'BANANA';}
ElseIf ($varString ==…

user3527285
- 79
- 1
- 8
-2
votes
3 answers
Preference for C# in adding, multiplication, and division
How does C# execute this?
static void Main(string[] args)
{
int i = 4;
i *= 4 + 8 / 2;
Console.WriteLine(i);
}
This was asked in one of the interview Questions. And I applied BODMAS to it.
But it was wrong. Please…

Prateik
- 241
- 2
- 6
- 14
-2
votes
2 answers
Relational algebra operations
I'm stuck with relational algebra.
I mean, how can I express functions like "SUM(), COUNT()," etc in RA?
Thanks, any help will be kindly appreciated

ubi_v
- 92
- 2
- 8
-2
votes
1 answer
Bits operations implementations
I have to return 1 if bit i in x is set, 0 otherwise in is_set function. I got stuck here. Have no idea what to do next...Any ideas?? Any help will appreciated....
#include
#include
const char *to_binary(unsigned int x) {
…

user3247903
- 69
- 8
-2
votes
2 answers
Java - Building calculator app and getting error when I press one operation then √
So I have a calculator app. built and it works correctly however if the user inputs for example 4+√ I get an error (shown below). I was told I need to find if the user has entered in an operation already when they hit the √ button and if they have…

Mark Shimala
- 65
- 10
-2
votes
1 answer
native PHP transfer operation to CPU
Is there any way to let the cpu handle some operations in PHP (quite like openCL) but is available in native php (without having PHP-openCL implemented)?
/E:
What i mean:
I am coding some php cli scripts
Everything you do in php (variables, etc.)…

Mohammer
- 405
- 3
- 15
-3
votes
1 answer
My data show up 2 twice whil use function? Operation file C++ - Case: Delete Specific Line in c++
I got a task that is:
Write a simple program that can be used to delete data on one
one line specified in a file with the following steps:
Manually create a file containing:
i. Fill from line 1
ii. Fill from line 2
ii. Fill from line 3
iv. Fill…

SKAR
- 3
- 2
-3
votes
1 answer
Go back to the original number after the sum of values between two lists
I wrote this code to sum a number and its reverse:
#sum the multiple of the first number and its reversed
zipped_lists = zip(primo, reversedList)
res = [x + y for (x, y) in zipped_lists]
print (res)
#search common values in…

Andrea Valsesia
- 17
- 5
-3
votes
1 answer
In python ,how can we perform conditional operations list where items or elements of list are keywords
tup=(1,'2',3.3,(1,4))
lst=list(map(type,tup))
print(lst)
for item in last:
if(item==class str)
print("success")
here "class str" is keyword but it is also the item of lst, any possible syntax to do conditional operations on keywords

surya vardhan
- 3
- 2
-3
votes
1 answer
Can you help me to solve errors in this code?
I started studying C ++ recently and I'm trying to create a "calculator" with a few operations.
But I'm stuck in string 26 (cin >> choose;), which seems unresponsive. Why?
//CALCULATOR
#include
using namespace std;
int main()
{
int…
-3
votes
2 answers
Ruby - Divide Items from one array by the items of a different array, one by one, and throw a new array
I have my two arrays
x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18]
y = [2, 4]
and I want to find the items from my array x that are divisible by the items of my array y, and create a new array with result numbers. In this…

Emilio Contreras
- 41
- 1
- 6
-3
votes
2 answers
how to add subtract divide and multiply columns on a dataframe?
i hope you can help me.
i need to get this result:
for item in each row, create Max(In/Out Util)-1Mbr column with result:
df['Max(In/Out Util)-1Mbr'] = [df['Max(In/Out Util)']/100*df['Egress
Speed']] / [df['Egress Speed']-(df['Egress…

juanpb12
- 125
- 1
- 9
-3
votes
3 answers
How to convert int number to two numbers witch first is made by odd bits and 2nd by even bits
How can I convert int=43707 to two other numbers?
The first number is made by value of odd bits. Second number is made by value of even bits.
int x = 43707; // 1010101010111011
var even = 0;
var odd = 0;
for (int i = 0; i<=31; i++) {
if(i%2…

Daniel
- 1
- 1
-3
votes
3 answers
c++ XOR between bitsets
std::bitset <1> a1;
std::bitset <1> a2;
a1 = std::bitset<1> (0);
a2 = std::bitset<1> (1);
std::bitset<1> b = (a1 ^= a2)
This results in
b = 1
which is fine but modifies also a1, which after the XOR operation becomes:
a1 = 1
Why is this…

rebrid
- 430
- 8
- 27