Answer:
The main problem is the incorrect use of assignment operator, the correct way to check if two number are equal is
num1==num2
Explanation:
Here we have a created a simple function which takes two input arguments num1 and num2. In the body of the function we have used if condition to find out whether the two number are equal or not. If condition is true then print that values are equal. If condition is false then print that values are not equal. In the driver code, we have called the function two times with different values of num1 and num2 to check if it is working correctly.
The implementation logic is same in all these programming languages, the only difference the syntax.
Python Code:
def checkEquality(num1, num2):
if num1 == num2:
print("The values are equal.")
else:
print("The values are not equal.")
Driver Code:
checkEquality(2,5)
checkEquality(3,3)
Output:
The values are not equal.
The values are equal.
C++ Code:
void checkEquality(int num1, int num2) {
if (num1 == num2)
cout<<"The values are equal."<<endl;
else
cout<<"The values are not equal."<<endl;
}
Driver Code:
#include <iostream>
using namespace std;
void checkEquality(int num1, int num2);
int main()
{
checkEquality(2,5);
checkEquality(3,3);
return 0;
}
Output:
The values are not equal.
The values are equal.
Answer:
%seperatethem.m
%Creation and definition of functions
function [l w] = separatethem(myrectangle)
%Call the structure field length.
l = myrectangle.length(1);
%Call the structure field length.
w = myrectangle.width(1);
%Ending call function.
end
%trial of program
%Create a structure with two fields length and width.
myrectangle = struct('length',33,'width',2);
%Call the function separate them.
[l w] = separatethem(myrectangle)
Answer:
58.44 g/mol The Molarity of this concentration is 0.154 molar
Explanation:
the molar mass of NaCl is 58.44 g/mol,
0.9 % is the same thing as 0.9g of NaCl , so this means that 100 ml's of physiological saline contains 0.9 g of NaCl. One liter of physiological saline must contain 9 g of NaCl. We can determine the molarity of a physiological saline solution by dividing 9 g by 58 g... since we have 9 g of NaCl in a liter of physiological saline, but we have 58 grams of NaCl in a mole of NaCl. When we divide 9 g by 58 g, we find that physiological saline contains 0.154 moles of NaCl per liter. That means that physiological saline (0.9% NaCl) has a molarity of 0.154 molar. We can either express this as 0.154 M or 154 millimolar (154 mM).