+ 2
Write program in c++to view the inverse of this number 234567?
2 odpowiedzi
+ 2
# include <iostream>
using namespace std;
int main ()
{
int inverse=0;
int num;
cout <<"enter number ";
cin >>num;
while (num!=0)
{
inverse=inverse*10;
inverse=inverse+num%10;
num=num/10;
}
cout <<inverse <<endl;
return 0;
}
+ 1
# include <iostream>
using namespace std;
int main ()
{
int num;
int rem;//remain
cout <<"enter number ";
cin>>num;
while (num!=0)
{
rem=num%10;
cout <<rem;
num =num/10;
}
return 0;
}
thanks my teachers 🙊🙈