To accept a three-digit number from the keypad (first ensure that three-digit), you calculate the sum output

#include <stdio.h>
int main ()
{
    int X, Y;
    int I = 0;
    the while (I == 0) {
         the printf ( "Please enter a three-digit: \ n-");
        Scanf ( "% D ", & X);
            IF (99 <X && X <1000) {
                Y = X / 100 + X% 100/10 + X% 10;
                the printf ("% D ", Y);
                I =. 1;
            } the else {
                the printf ( "You do not enter the three-digit!"); 
            } 
    }
    return 0;
}

Guess you like

Origin www.cnblogs.com/1994jinnan/p/12078797.html