[White] [Diary of an error has been resolved errors C language simple sum = a + b program encountered

Today, ready to re-read through the basics of the C language, write a small program with a simple request of the sum of a and b. But the result turned out not to have been returned, the source code is as follows:

#include <stdio.h>
 int main () 
{ 
    int A, B, SUM; 
    the printf ( " Please enter the number of the value of two, spaced \ n comma " ); 
    Scanf ( " % D, D% " , A & , & B); 
    SUM = a + B; 
    the printf ( " \ n-two numbers are D% " , SUM); 

}

However, running is not the result of a and b and checked again, and there is no obvious error.

Finally found is the use of full-width during input comma separate the two numbers, resulting in abnormal results.

Later try to use spaces in the programming process, etc., will be input separately, to avoid mistakes.

Guess you like

Origin www.cnblogs.com/lijitao/p/12114141.html