close
Blogtrottr
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 已解決
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 已解決 
50% off Print Subscription of USA Today

Get the news delivered to your doorstep. Lock in the savings and receive USA Today for just $0.75 a day.
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
    全站熱搜
    創作者介紹
    創作者 yahauiuyt 的頭像
    yahauiuyt

    奇皇后線上看16, 奇皇后線上看15, 奇皇后線上看18, 奇皇后線上看11, 奇皇后線上看第13集, 奇皇后線上看tv, 奇皇后線上看19, 奇皇后線上看第7集

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