#include <stdio.h>
#include <conio.h>
#include <iostream.h>
int bil (int b, int a, int *banyak);
void main()
{
int b,a,banyak;
banyak=0;
cout << " BILANGAN GENAP " << endl;
cout << " ---------------- "<<endl;
cout << " batas bawah = ";cin >> b;
cout << " batas atas = ";cin >> a;
bil(b,a,&banyak);
cout << " jumlah = " << banyak;
getch();
}
int bil(int b, int a,int *banyak){
int x;
for (x=b; x<=a; x++){
if(x % 2 == 0){
*banyak = *banyak+1;
}
}
return(*banyak);
}
0 komentar:
Posting Komentar