That is false. are you doing it on a computer course. <span />
Answer:
The code to this question can be given as:
Code:
while ((s!="Y" && s!="y" && s!="N" && s!="n")) //loop for check condition
{
cin >> s; //insert value
}
Explanation:
The description of the following code:
- In this code, we use a string variable s that has been to define in question.
- In code, we use a while loop. It is an entry control loop in loop we check variable s value is not equal to "y", "Y", "n" and "N".
- In the loop we use AND operator that checks all value together. If this is true So, we insert value-form user input in string variable that is "s".
Answer:
Using python programming language.
Explanation:
#to define the function write as below
def equal():
#to get the two integers from the user
#The user is asked for input in the code below.
x = int(input("Enter the value for X"))
y= int(input("Enter the value for y"))
if x==0 and y==0:
print("both numbers are ", "0")
elif: x==1 and y==1: #This test if both x and y are 1
print("true")
elif: x==y: #this line test if both values are equal
print("true")
else:
print("False")
equal() #end of the function
Answer:
void swapints(int *j,int *k)//Function definition.
{
*j=*j+*k-(*k=*j); //value swapping.
}
swapints(&j,&k);//call the function.
Explanation:
- The above function definition takes the address of j and k variables which is stored on the pointer variable j and k.
- Then the pointer variable uses the j and k value for the above expression, and the user does not need to return the value of j and k.
- But when the user prints the value of the j and k variable, then he gets the swapping value of the j and k variable.
- The user needs to know that the "int j" is a normal variable, but "int *j" is a pointer variable that is used to take the address of j variable.