Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- using namespace std;
- main (){
- int b=0, nomor, genap = 0, ganjil = 0;
- for (int a=1; a <=10; a++){
- cout << "bilangan : "; cin >> nomor ;
- if (nomor % 2 == 0){
- genap = genap +1;
- }else{
- ganjil = ganjil + 1;
- }
- b = b + nomor ;
- }
- cout << "Jumlah bil. ganjil :" << ganjil << endl;
- cout << "Jumlah bil. genap :" << genap << endl;
- cout << " total jumlah bil :" << b << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment