Redaksiya
This problem is meant to be simple and help you get started with Eolymp. But if you need some help, hopefully this page can provide you with some explanations.
You are given a two digit integer, a number from to , and you have to print each digit separately.
There are two approaches to solving this problem: using numbers and math or using strings.
Number and math
In the first approach, you can read the number from the standard input stream (stdin), calculate the first digit by dividing the number by and the second digit by finding modulo , then print results separated by a space.
#include <iostream> using namespace std; int main(){ int a; cin>>a; int f = a / 10; // find the first digit, since f is an integer, the decimal part will be ignored int s = a % 10; // find second digit cout<< f <<" "<< s << endl; return 0; }
Strings
In the second approach, you can read input as a string and simply output the first and second characters separated by a space.
#include <iostream> using namespace std; int main(){ string a; cin>>a; cout<< a[0] <<" "<< a[1] << endl; return 0; }
Both of these solutions are correct and will pass all test cases.