PROGRAM MENCARI NILAI MAKSIMUN
12.16
By
Unknown
KASUS 6
0
komentar
menentukan nilai maksimum dari n bilangan
ALGORITMA
Deklarasi
i, temp : integer
Deskripsi
temp =data[1]
for i = 2 to n do
temp =maksimum2(temp, data[i])
maksimum = temp
#include <iostream>
#include <string>
using namespace std;
int main()
{
string raptor_prompt_variable_zzyz;
int i;
int nilai;
int x;
int A[100];
A[100] = 0;
i =1;
nilai =0;
raptor_prompt_variable_zzyz ="Masukan X : ";
cout << raptor_prompt_variable_zzyz << endl;
cin >> x;
while (!(i>x))
{
raptor_prompt_variable_zzyz ="Masukan Bilangan : ";
cout << raptor_prompt_variable_zzyz << endl;
cin >> A[i];
if (A[i]>nilai)
{
nilai =A[i];
}
else
{
}
cout << "Nilai "<<i<<" ; "<<nilai << endl;
i =i+1;
}
cout << "Nilai Maksimum : "<<nilai << endl;
return 0;
}
FLOWCHART :
0 komentar: