type="text/javascript">

Rabu, 02 April 2014

Kasus 4.8

menghitung a * b dengan metode penjumlahan

#program c++ :
#include <cstdlib>
#include <iostream>
#include <math.h>

using namespace std;

int main(int argc, char *argv[])
{
    int a,b,jumlah=0;
    cout<<"program menghitung perkalian dengan cara penjumlahan"<<endl;
    cout<<"Masukkan nilai a =";cin>>a;
    cout<<"Masukkan nilai b =";cin>>b;
    for(int i=1;i<=abs(b);i++);
    jumlah+=a*b;
    if(b<0)jumlah = -jumlah;
    cout<<a<<" x "<<b<<" = "<<jumlah;
    cout<<endl;
   

    system("PAUSE");
    return EXIT_SUCCESS;
}
 


#Screenshot

 

 

1 komentar:

  1. Blackjack Casino in Columbus, OH - Mapyro
    Casino Type. Blackjack. A blackjack variant of standard casino games can be 충청남도 출장안마 found in many casinos 김천 출장샵 throughout 대구광역 출장마사지 the United 경산 출장마사지 States. Blackjack also 제천 출장샵

    BalasHapus