+ 1

Help me with this one I'm a beginner

Sum and Return the result in reverse order int num, add, digit; cout <<Insert a number: cin>>num; while (num!=0) digit=num%10; num=num/10; //now adding an increment int ant = digit +add; //Now the new number in reverse order ant=ant×10+digit; cout <<the new number is <<ant <<endl;

5th Mar 2017, 9:55 AM
Neo Antonia
Neo Antonia - avatar
4 Answers
0
#include<iostream.h> void main() { int num,digit,ant=0; cout <<"Insert a number"; cin>>num; while (num>0) { digit=num%10; num=num/10; ant=ant×10+digit; } cout <<"the new number is "<<ant<<endl; }
5th Mar 2017, 10:07 AM
vishnu
vishnu - avatar
0
be careful with the syntax of every thing like.. cout<<"...."; the quotation marks, semicolon etc..
5th Mar 2017, 10:09 AM
vishnu
vishnu - avatar
0
Good answer, but I must pick the result of this operation and add an increment and give the result in reverse order.
5th Mar 2017, 10:11 AM
Neo Antonia
Neo Antonia - avatar