Answer to Question #99420 in C++ for Caleb

Question #99420
Write an expression that prints "Special number" if specialNum is 0, -99, or 44.
#include <iostream>
using namespace std;

int main() {
int specialNum;

cin >> specialNum;

if (/* Your solution goes here */) {
cout << "Special number" << endl;
}
else {
cout << "Not special number" << endl;
}

return 0;
}
1
Expert's answer
2019-12-09T14:03:24-0500

Required expression:


 specialNum == 0 || specialNum == -99 || specialNum == 44



The whole code:


#include <iostream>


using namespace std;


int main() {

 int specialNum;

 cin >> specialNum;

 if ( specialNum == 0 || specialNum == -99 || specialNum == 44 ) {

  cout << "Special number" << endl;

 }

 else {

  cout << "Not special number" << endl;

 }


 return 0;

}



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS