Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n;
- float angka, jumlah;
- cout << "\t Jumlah dan Rata2 Bilangan \n";
- cout << "\n Masukkan Jumlah Data : ";
- cin >> n;
- cout << endl;
- for (int i = 1; i <= n; i++)
- {
- cout << " Data Ke " << i << " : ";
- cin >> angka;
- jumlah += angka;
- }
- cout << "\n Jumlahnya : " << jumlah;
- cout << "\n Rata-ratanya : " << jumlah / n;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement