#include <iostream>
using namespace std;
int main()
{
int num;
//input number
cout << "Enter two-digit integer: ";
cin >> num;
//validate
if (num < 100 && num >= 10)
{
//encode
num = ((num + 7) % 10) * 10 + ((num / 10 + 7) % 10);
//print number
if (num < 10) cout << 0;
cout << num << endl;
}
//if number is not valid
else
{
cout << "Number is not valid" << endl;
}
return 0;
}
Comments
Leave a comment