Archive for 九月, 2012

bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

Tags: , ,

26
九月

程式設計一程式 09/26: 程式Ex2

   Posted by: admin    in 101(上)程式設計(一)

include stdio.h
int main()
{
    int id=1014 43421;
    int i;
    int digit;
    int odd = 0;
    int even = 0;
 
    digit = id % 10;
    printf("%d\n", digit);
    if (digit%2 ==0)
       even = even + 1
    else
       odd = odd + 1
 
    for (i=0; i<8; i++)
    {
        id =  id /10;
        digit = id % 10;
        printf("%d\n", digit)
        if (digit%2 ==0)
           even = even + 1
        else
            odd = odd + 1
    }
    printf("Odd=%D Even = %D", odd, even);
}

bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

Tags: , ,

bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

Tags: , ,

bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

Tags: , ,