write a program using delphi to calculate and store the average obtained by 5 students and print the student that made the highest mark
#include <iostream>
using namespace std;
int main() {
int students[5];
for (int i = 0; i < 5; i++) {
cin >> students[i];
}
int max = INT_MAX;
int idx = 0;
for (int i = 0; i < 5; i++) {
if (max < students[i]) {
max = students[i];
idx = i;
}
}
cout << "Student number "
<< idx + 1
<< " has highest mark\n";
return 0;
}
Comments
Leave a comment