how to print digits from right to left in c++
Answers
Answered by
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
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
Physics,
5 months ago
Hindi,
5 months ago
Social Sciences,
5 months ago
Chemistry,
10 months ago
Social Sciences,
10 months ago
Physics,
1 year ago