KASUS 4.4

Menghitung rata-rata dari integer positif (banyak data di tentukan dari data uyang dimasukkan)

Menggunakan Program C++


#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
    int n=1;
    float r,x,o,j=0;
    cout<<"Data ke 1 =";cin>>o;
    while (n<10){
        cout<<"Data Ke "<<n+1<<" =";
        cin>>x;
        j+=x;
        n++;
    }
    float h=j+o;
    cout<<"Jumlah ="<<h<<endl;
    cout<<"Rata-Ratanya ="<<h/n;
    return 0;
}
 Menggunakan Program Raptor


Share this

Related Posts

Previous
Next Post »

:)
:(
hihi
:-)
:D
=D
:-d
;(
;-(
@-)
:P
:o
:>)
(o)
:p
:-?
(p)
:-s
(m)
8-)
:-t
:-b
b-(
:-#
=p~
$-)
(y)
(f)
x-)
(k)
(h)
cheer