Lab 9
Lab 9
Q#1;
#include<iostream>
using namespace std;
int main() {
int arr[100], l = 0, m = 0 ;
cout << "enter the number:\n";
for (int i = 0; i < 100; i++) {
cin >> arr[i];
}
for (int k = 0; k < 10;k ++) {
int j = 0;
j = arr[k];
if (j % 2 == 0) {
l = l + 1;
}
else {
m = m + 1;
}
}
cout << "even:";
cout << l<<endl;
cout << "odd:" << m;
Output;
Q#03;
#include<iostream>
using namespace std;
int main() {
int arr[10],j=INT_MAX;
cout << "enter the number:\n";
for (int i = 0; i < 10; i++) {
cin >> arr[i];
}
for (int k = 9; k >= 0; k--) {
j = arr[k];
cout << j<<",";
}
return 0;
OUTPUT;
Q#4;
#include <iostream>
using namespace std;
int main() {
double temp[7], s = 0, high, low;
if (i == 0) {
high = temp[i];
low = temp[i];
}
else {
if (temp[i] > high) {
high = temp[i];
}
double average = s / 7;
cout << "High temp: " << high << endl;
cout << "Low temp: " << low << endl;
cout << "Average temp: " << average << endl;
return 0;
}
Output;