十进制输入输出和空格占位

十进制输入输出和空格占位

Time Limit: 1000 ms Memory Limit: 65536 KiB

Submit Statistic

Problem Description

输入一个整数,请你按如下要求输出:

第一行按原样输出,

第二行按原样靠右输出,不足 8 位左补空格并在两端添加星号包裹,

第三行按原样靠左输出,不足 8 位右补空格并在两端添加星号包裹。

Input

一个int范围内的正整数 a 。 

Output

共三行,按题目描述输出。

扫描二维码关注公众号,回复: 4008431 查看本文章

Sample Input

123456

Sample Output

123456
*  123456*
*123456  *

Hint

Source

行走的二叉树

#include <iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{

int n;
scanf("%d",&n);
printf("%d\n",n);
printf("*%8d*\n",n);
printf("*%-8d*\n",n);

    return 0;
}

猜你喜欢

转载自blog.csdn.net/chen_zan_yu_/article/details/83926720