Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I can\'t figure out the error in this programme, can you help my the prompt is W

ID: 672689 • Letter: I

Question

I can't figure out the error in this programme, can you help my

the prompt is

Write a C++ program to enter an integer number of 4 digits and print it out in an inverse order.


And my code

#include<iostream>
using namespace std;
int main()
{int num,a,b,c,d,newnum;
cout<<" Enter Your Number:"<<endl;
cin>>num;
a=num%10;
num=num/10;
b=num%10;
num=num/10;
c=num%10;
num=num/10;
d=num%10;
newnum=(a*1000)+(b*100)+(c*10)+(d*1)
cout<<" Your Number Is:"<<newnum;
return 0;}

Explanation / Answer

#include<iostream>
using namespace std;
int main()
{int num,a,b,c,d,newnum;
cout<<" Enter Your Number:"<<endl;
cin>>num;
a=num%10;
num=num/10;
b=num%10;
num=num/10;
c=num%10;
num=num/10;
d=num%10;
newnum=(a*1000)+(b*100)+(c*10)+(d*1);
cout<<" Your Number Is:"<<newnum;
return 0;}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote