Blogtrottr
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 已解決
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 已解決 
The Best Way to Manage your Money.

Start using Mint today to set a budget, track your goals and do more with your money.
From our sponsors
C語言 直式乘法
Dec 2nd 2013, 20:41

// 程式開始
#include "stdio.h"
#include "conio.h"

void main()
{
    unsigned int a, b, c, d;
    double check;
    int i, input_ok = 0;

    while (!input_ok) {
        printf("請輸入被乘數: "); scanf("%u", &a);
        printf("請輸入  乘數: "); scanf("%u", &b);
        check = (double)a*b;
        if (check <0 || check > 4294967295L) {
            printf("乘積必須介於0 ~ 4294967295之間\n\n");
        }
        else
            input_ok = 1;
    }
    printf("\n%22u\n", a);
    printf("x%21u\n", b);
    printf("----------------------\n");
    for (c=b, i=0; c>0; c=c/10, i++) {
        d = c%10;
        printf("%*u\n", 22-i, d*a);
    }
    printf("----------------------\n");
    printf("%22u\n", a*b);
    _getch();
}
// 程式結束

執行結果:
請輸入被乘數: 1546
請輸入  乘數: 6879

                  1546
x                 6879
----------------------
                 13914
                10822
               12368
               9276
----------------------
              10634934

This entry passed through the Full-Text RSS service — if this is your content and you're reading it on someone else's site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 gyyci33a17tqf 的頭像
    gyyci33a17tqf

    繼承者們線上看, 繼承者們劇情, 繼承者們演員, 繼承者們13, 繼承者們插曲, 繼承者們15, 繼承者們14, 繼承者們 ost, 繼承者們 維基, 繼承者們第13集

    gyyci33a17tqf 發表在 痞客邦 留言(0) 人氣()