Computer Science, asked by chinmai7122, 10 months ago

how to print digits from right to left in c++

Answers

Answered by IRONMAN44
1

Answer:

Try this buddy is you are dealing with number

Explanation:

#include <iostream>

using namespace std;

int main()

{

int num;

int a = 0;

cout << "Enter a number: ";

cin >> num;

cout << "\n";

for (int i = 1; num > 0; i++) {

a = num % 10;

cout << a;

num = num / 10;

}

return 0;

}

Answered by monisushmakavila
0

Answer:

#include <iostream>

using namespace std;

int main()

{

int num;

int a = 0;

cout << "Enter a number: ";

cin >> num;

cout << "\n";

for (int i = 1; num > 0; i++) {

a = num % 10;

cout << a;

num = num / 10;

}

return 0;

}

enter a number: 123456

654321

Explanation:

hope it helps mark me as brainliest

Similar questions