High-precision Addition

Source: Internet
Author: User

Using the Library of functions:

#include <stdio.h> #include <string.h> #include <stdlib.h>

Source Code (addition):

#include <stdio.h> #include <string.h> #include <stdlib.h> int main (void) { char s1[100],s2[100],s3[100],s4[100],s5[100],s6[100]  //because it is a sub-total program, please ignore the extra long N=-1,n1=0,n2=0,n3=0,x1,x2,x3,x4,x5,x6,y3,y4 scanf ("%s ", S5)                      //input string s5 scanf ("%s ", S6)                      //input string s6

x5=Atol (S5); //Use the Stdlib function library to atol* (convert string to grow integer number)

x6=Atol (S6); //Convert string S5, S6 to Long X5 X6 If (x5<0&&x6>=0) //Set if X5, X6 a positive and negative situation { n3=x5-x6; //Set-case relationship } else //negative and positive conditions { n3=x6-x5; //Relationship type } if (x5>=0&&x6>=0| |                        X5<0&&X6<0) //Set X5, X6 symbol under the same conditions { n3=x5+x6; X5, X6 and N3 when//x5 and X6 symbols are the same } printf ("%d", N3); return 0; }

Author Evaluation:

Because of the limitations of the ATOL, so this program is "quasi", temporarily can only be in the "long" type of the high accuracy of the data plus minus, not a good program, but because he is a part of an integrated program, so more practical. Please sir wait for a moment, the full version will appear in your eyes!

Please comment on the error, new report, tender, wrong please point out.

High-precision Addition

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.