0% found this document useful (0 votes)
2 views2 pages

Array

The document presents two programming exercises. The first exercise requires a program to determine if a week is considered an extreme hot week based on daily temperatures, while the second exercise involves finding the largest product of two consecutive integers in an array. Both exercises include input and output specifications along with examples.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Array

The document presents two programming exercises. The first exercise requires a program to determine if a week is considered an extreme hot week based on daily temperatures, while the second exercise involves finding the largest product of two consecutive integers in an array. Both exercises include input and output specifications along with examples.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Exercise 1

A week is considered an extreme hot week if there are 4


days with temperature over than 35oC. Write a program to
input the temperature of 7 days, and print 1 if that week
is an extreme hot week, and print 0 otherwise.
Input
• A float array of 7 elements
Output
• A value of 0 or 1
Example
Input Output
30, 35.5, 37.6, 37, 36.5,
1
37.5, 36.5
30, 31.5, 30.6, 31, 33.5,
0
35.5, 36.5

Exercise 2
Write a program that allows entering an array of integers
(up to 10 elements), printing to the screen the largest
product of two consecutive elements. If the array has only
1 element return 0.
Input:
- Line 1 contains an integer n, the number of elements of
the array (2 <= n <=10)
- Line 2: contains a list of numbers separated by spaces
Output:
- The product of the largest 2 consecutive elements
Example
Input Output
4
27
19326
1
0
29

You might also like