Let B be represented by the letter "hundred", the letter S denotes "ten", with "12 ... n" to indicate a digit n (<10), any change in format to output a positive integer of not more than 3. 234 should be output as e.g. BBSSS1234, because it has two "hundred", 3 "ten", and 4 bits.
Input format: Each test input comprises a test gives a positive integer n (<1000).
Output format: one row for each output test, with n predetermined output format.
Sample Input 1:
234
Output Sample 1:
BBSSS1234
Input Sample 2:
23 is
output Sample 2:
SS123
#include <stdio.h>
int main() {
int bai, shi, ge, num;
scanf("%d", &num);
bai = num / 100;
shi = num / 10 % 10;
ge = num % 10;
for (int i = bai; i > 0; i--) {
printf("B");
}
for (int i = shi; i > 0; i--) {
printf("S");
}
for (int i = 1; i <= ge; i++) {
printf("%d", i);
}
return 0;
}
Test Results: