[go: up one dir, main page]

0% found this document useful (0 votes)
4 views1 page

PF_HW_2

Uploaded by

a08776607
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)
4 views1 page

PF_HW_2

Uploaded by

a08776607
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/ 1

GOVT.

GRADUATE COLLEGE FOR WOMEN, SAMANABAD, LAHORE


PROGRAMMING FUNDAMETALS
HOMEWORK # 2
Submission Date: Monday, January 20, 2025
Instructions:
i. Late submission will not be acceptable.
ii. It is a hand written assignment, Clearly mention your Full Name and
Roll Number. Use simple sheets, Colorful pages will not be acceptable.
iii. Zero credit for copy cases (either fellow student or internet).

Rainfall Statistics
Write a program that lets the user enter the total rainfall for each of 12 months into an
array of doubles. The program should calculate and display the total rainfall for the
year, the average monthly rainfall, and the names of months with the highest and
lowest amounts.
Input Validation: Do not accept negative numbers for monthly rainfall figures.
Hints:
1. Take input in one loop. Calculate values in another loop
2. You will require four (04) different variables to store the above mentioned values
3. To make comparisons (after taking input) you can assume the first element of the
array as max & min i.e., max = min = rainfall[0];
4. There is no need to take months names as input.
5. Devise a mechanism to find which month had the lowest and highest rainfall and
then display the names of the months.

 HAPPY CODING TO YOU 

You might also like