the program below is supposed to input a number of 3 digits fromthe user and out
ID: 3616770 • Letter: T
Question
the program below is supposed to input a number of 3 digits fromthe user and output its digits backwards. I.e., 123 as input wouldbe displayed as 321. it says, Do Not usestrings for this program. think about integer arithmeticoperators like division and modulus.#include <iostream>
using namespace std;
int main ()
{
int num; // the input number
int d1, d2, d3; // the digits
cout << "Enter a 3 digit number ";
cin >> num;
cout << "Your number is " << num<< endl;
d1 = num/100;
num = num ;
d2 = num/10;
d3 = num%10;
cout << "The number reversed is " <<d3 << d2 << d1 << endl;
return 0;
}
Thank you
Explanation / Answer
please rate - thanks using your code --you were almost there! #include using namespace std; int main () { int num; // the input number int d1, d2, d3; // the digits cout > num; coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.