Description
输入一个整数,请你按如下要求输出:
第一行按原样输出,
第二行以八进制靠右输出,不足 8 位左补 0 并在两端添加星号包裹,
第三行以八进制靠左输出,不足 8 位右补空格并在两端添加星号包裹。
Input
一个int范围内的正整数 a 。
Output
共三行,按题目描述输出。
Sample
Input
123
Output
123 *00000173* *173 *
#include <stdio.h>
int main()
{
int x;
scanf("%d",&x);
printf("%d\n",x);
printf("*%08o*\n",x);
printf("*%-8.0o*\n",x);
}
未经允许不得转载:作者:Monarchdos,
转载或复制请以 超链接形式 并注明出处 吾爱博客。
原文地址:《八进制数输出和占位》 发布于2020-11-29
评论 抢沙发