#include <iostream.h>
#include <conio.h>
void cetak(int n)
{
int i;
for (i=1; i<=n; i++)
cout << "Harga n = " << i << endl;
}
main() {
int n;
cout << "Masukkan harga n : "; cin >> n;
cetak(n);
getch();
return 0;
}
Hasil: