0
IN CPP, How to get a 2 digit number from user and output it on 2 sperate lines?
Like get the number 32 and output it like 3 2 Is it even possible?
6 Respuestas
+ 2
//Method 1
#include <iostream>
using namespace std;
int main() {
int num = 32;
cout << num/10 <<endl;
cout << num%10 << endl;
}
+ 5
Why not?
How you can do it in maths? Find logic, implement in code..
edit: can you share your idea..? so that we can understand what you expecting.....
+ 2
There are multiple ways.
Easiest is probably:
32 / 10 = 3
32 % 10 = 2
+ 1
You're not doing any math here, so %c seems like the easiest answer.
edit: sorry, c brain there; just use char x, y; instead of int x, y;
0
Faran allahverdi
It is possible but you will need two inputs :-
Eg. Int x,y;
cin>>x;
cin>>y;
Input*: x=3 & y=2
Output*: 3
2