Title Description DescriptionReads three integers, with each integer representing 8 characters in width and right-aligned to output them.
input/output format input/output
Input Format:
There is only one row, containing three integers, separated by a space between the integers.
output Format:
There is only one row, which sequentially outputs three integers, separated by a single space, according to the format requirement.
input and Output sample sample Input/output
sample Test point # #
Input Sample:
123456789 0-1
Sample output:
123456789 0-1
Idea: This problem is simple, first count the number of three digits, and then the front output (8-digit) of the space can be.
The code is as follows:
1#include <stdio.h>2 intFuninta)3 {4 intCount=0;//used to calculate the number of digits5 while(a)6 {7a=a/Ten;8count++;9 }Ten returnCount; One } A intMain () - { - inta,b,c; the inti; -scanf"%d%d%d",&a,&b,&c); - /*==========================*///align a - for(i=0;i<8-(Fun (a)); i++) + { -printf" "); + } Aprintf"%d", a); at /*==========================*///Align B - for(i=0;i<8-(Fun (b)); i++) - { -printf" "); - } -printf"%d", b); in /*==========================*///Snap to C - for(i=0;i<8-(Fun (c)); i++) to { +printf" "); - } theprintf"%d", c); * return 0; $}
Openjudge-noi-align the output