Math Problem Statement

输入一个4位正整数,将其加密后输出。 【问题描述】输入一个4位正整数,将其加密后输出。加密方法是,将该数每位上的数字加9,然后除以10取余,所得结果作为该位上的新数字,最后将千位数和十位数互换,百位数和个位数互换,组成加密后的新4位数。 【样例输入】(下划线部分表示输入) Enter a number:1257 【样例输出】 The encrypted number is 4601 【样例说明】 每位上的数字加9 除以10 取余后得0146,交换后得到4601。 冒号后面无空格。 取余函数%,例如:12%10=2 整除,例如:12/10=1

Solution

Ask a new question for Free

By Image

Drop file here or Click Here to upload

Math Problem Analysis

Mathematical Concepts

Modular Arithmetic
Basic Number Manipulation

Formulas

(digit + 9) % 10

Theorems

-

Suitable Grade Level

Grades 5-8