Question

Write the C++ code necessary to determine if the value of a variable named myVariable is...

Write the C++ code necessary to determine if the value of a variable named myVariable is equal to 6. If the value of myVariable is equal to 6, then subtract one from the variable yourVariable.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

ANSWER: Here I am giving you the code and output where in the code I have taken input of myVariable and yourVariable and perform your vaidation if you still have any doubt then comment on it or like it.

CODE:

#include <iostream>
using namespace std;

int main()
{
int myVariable, yourVariable;
cout<<"Enter the value of myVariable:";
cin>>myVariable;
cout<<"Enter the value of yourVariable:";
cin>>yourVariable;
  
if(myVariable==6){
yourVariable=yourVariable-1;
}
cout<<"Value of yourVariable after change now:"<<yourVariable;
return 0;
}

OUTPUT:

Add a comment
Know the answer?
Add Answer to:
Write the C++ code necessary to determine if the value of a variable named myVariable is...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT