close
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
    全站熱搜
    創作者介紹
    創作者 gyyij7s6y6fly 的頭像
    gyyij7s6y6fly

    線上遊戲排行榜2013/2014,進擊的巨人線上看,candy crush saga外掛,正妹寫真三圍

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