0% found this document useful (0 votes)
3 views3 pages

Lab 9

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

Lab 9

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

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;

cout << "Enter the temp readings:" << endl;


for (int i = 0; i < 7; ++i) {
cout << "Day " << i + 1 << ": ";
cin >> temp[i];
s += temp[i];

if (i == 0) {
high = temp[i];
low = temp[i];
}
else {
if (temp[i] > high) {
high = temp[i];
}

if (temp[i] < low) {


low = temp[i];
}
}
}

double average = s / 7;
cout << "High temp: " << high << endl;
cout << "Low temp: " << low << endl;
cout << "Average temp: " << average << endl;

return 0;
}

Output;

You might also like