Openjudge-noi-align the output

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.