Nyist 74 pupils Arithmetic

Source: Internet
Author: User

Question 74
Question information running result this question ranking discussion area pupils Arithmetic
Time Limit: 3000 MS | memory limit: 65535 KB
Difficulty: 1
Description
When learning addition, many pupils find that "carry" is particularly prone to errors. Your task is to calculate the number of carry-places required for adding two three-digit numbers. Your program should be able to process multiple groups of data continuously until two zeros are read (this is the end mark of input ).
Input
Input two positive integers m, n. (m, n, all three digits)
Output
Output M, N. How many times do I have to carry when I add them.
Sample Input
123 456
555 555
123 594
0 0 sample output
0
3
1

 

# Include <iostream>
Using namespace STD;
Int main ()
{
Int m, n, I, J, K;
While (CIN> m> n, m | N) // while (CIN> m> N, M & N)
{
If (M> = 100 & M <1000) & (n> = 100 & n <1000 ))

If (M % 10 + N % 10> = 10) I = 1; else I = 0; // bit
If (M/10% 10 + N/10% 10 + I> = 10) j = 1; else J = 0; // ten ·
If (M/100% 10 + N/100% 10 + j> = 10) k = 1; else K = 0; // hundreds of digits ·


Cout <I + J + k <Endl;
}

}

 

***************************
**************************************
# Include <iostream>
Using namespace STD;
Int main ()
{
Int m, n, I, J, K;
While (CIN> m> N)
{
If (M> = 100 & M <1000) & (n> = 100 & n <1000 ))

If (M % 10 + N % 10> = 10) I = 1; else I = 0; // bit
If (M/10% 10 + N/10% 10> = 10) j = 1; else J = 0; // ten ·
If (M/100% 10 + N/100% 10> = 10) k = 1; else K = 0; // hundreds of digits ·


Cout <I + J + k <Endl;
}

}

 

***********
Error


**********************

 


# Include <iostream>
Using namespace STD;
Int main ()
{
Int m, n, I, J, K;
While (CIN> m> n, m | N)
{
If (M> = 100 & M <1000) & (n> = 100 & n <1000 ))

If (M % 10 + N % 10> = 10) I = 1; else I = 0; // bit
If (M/10% 10 + N/10% 10> = 10) j = 1; else J = 0; // ten ·
If (M/100% 10 + N/100% 10> = 10) k = 1; else K = 0; // hundreds of digits ·


Cout <I + J + k <Endl;
}

}


**************************************** ***********************

 

# Include <iostream>
Using namespace STD;
Int main ()
{Int A, B;
While (CIN> A> B)
{
Int S = 0;
If (A = 0 & B = 0) break;
If (a % 10 + B % 10 >=10) {s ++ ;}
If (a % 10 + B % 10> = 10) & (A/10% 10 + B/10% 10 + 1)> = 10 )) {s ++ ;}
If (A/10% 10 + B/10% 10)> = 10 | (a % 10 + B % 10> = 10 & (A/10% 10 + B/10% 10 + 1> = 10 ))) {s ++ ;}
Cout <S <Endl;
}
}

 

****************************

 

# Include <stdio. h>
Int main ()
{
Int m, n, I, J, K;
While (scanf ("% d", & M, & N) & M! = 0 & n! = 0)
{
If (M> 100 & M <1000 & n> 100 & n <1000)
{
If (M % 10 + N % 10)> = 10) I = 1; else I = 0;
If (M/10% 10 + N/10% 10 + I)> = 10) j = 1; else J = 0;
If (M/100 + N/100 + J)> = 10) k = 1; else K = 0;
}
Printf ("% d \ n", I + J + k );
}
}

 


++ ++

 

 

# Include <stdio. h>
Int main ()
{
Int m, n, I, J, K;
While (scanf ("% d", & M, & N) & M! = 0 & n! = 0)
{
If (M> 100 & M <1000 & n> 100 & n <1000)

If (M % 10 + N % 10)> = 10) I = 1; else I = 0;
If (M/10% 10 + N/10% 10 + I)> = 10) j = 1; else J = 0;
If (M/100 + N/100 + J)> = 10) k = 1; else K = 0;

Printf ("% d \ n", I + J + k );
}
}

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.