Solution:
Copy the program specified below to the program section in the C compiler
#define NUMMONTHS 12
#define NUMYEARS 5
#include
// function prototypes
void inputdata();
void printdata();
// Global variables
// These are available to all functions
float Raindata[NUMYEARS][NUMMONTHS];
char years[NUMYEARS][5] = {“2011″,”2012″,”2013″,”2014″,”2015”};
char months[NUMMONTHS][12]
={“Jan”,”Feb”,”Mar”,”Apr”,”May”,”Jun”,”Jul”,”Aug”,”Sep”,”Oct”,”Nov”,”Dec”};
int main ()
char enterData = ‘y’;
printf(“Do you want to input Precipatation data? (y for yes)n”);
scanf(“%c”,&enterData);
if (enterData == ‘y’) {
// Call Function to Input data
inputdata();
// Call Function to display data
printdata();
printf(“No data was input at this timen”);
printf(“Please try the Precipitation program again. n”);
return 0;
// function to inputdata
void inputdata() {
/* variable definition: */
float Rain=1.0;
// Input Data
for (int year=0;year < NUMYEARS; year++) {
for (int month=0; month< NUMMONTHS; month++) {
printf(“Enter rain for %d, %d:n”, year+1, month+1);
scanf(“%f”,&Rain);
Raindata[year][month]=Rain;
n to printdata
void printdata(){
// Print data
printf (“yeart montht rainn“);
for (int year=0;year < NUMYEARS; year++) {
for (int month=0; month< NUMMONTHS; month++) {
printf(“%st %st %5.2fn”,
years[year],months[month],Raindata[year][month]);
Choose input type as text and enter the input data in the text Section
Solution:
Program:
#define NUMMONTHS 12
#define NUMYEARS 5
#include
// function prototypes
void inputdata();
void printdata();
void printsumofrainfall();
// Global variables
// These are available to all functions
float Raindata[NUMYEARS][NUMMONTHS];
char years[NUMYEARS][5] = {“2011″,”2012″,”2013″,”2014″,”2015”};
char months[NUMMONTHS][12]
={“Jan”,”Feb”,”Mar”,”Apr”,”May”,”Jun”,”Jul”,”Aug”,”Sep”,”Oct”,”Nov”,”Dec”};
int main ()
{
char enterData = ‘y’;
printf(“Do you want to input Precipatation data? (y for yes)n”);
scanf(“%c”,&enterData);
if (enterData == ‘y’) {
// Call Function to Input data
inputdata();
// Call Function to display data
printdata();
// Call Function to determine the sum of rainfall in each year
printsumofrainfall();
printf(“No data was input at this timen”);
printf(“Please try the Precipitation program again. n”);
return 0;
// function to inputdata
void inputdata() {
/* variable definition: */
float Rain=1.0;
// Input Data
for (int year=0;year < NUMYEARS; year++) {
for (int month=0; month< NUMMONTHS; month++) {
printf(“Enter rain for %d, %d:n”, year+1, month+1);
scanf(“%f”,&Rain);
Raindata[year][month]=Rain;
// Function to printdata
void printdata(){
// Print data
printf (“yeart montht rainn”);
for (int year=0;year < NUMYEARS; year++) {
for (int month=0; month< NUMMONTHS; month++) {
printf(“%st %st %5.2fn”,
years[year],months[month],Raindata[year][month]);
// Function to printsumofrainfall
void printsumofrainfall(){
printf(“nThe Sum of rainfall for each year is given below:n”);
printf (“yeart sum_of_rainfalln”);
for (int year=0;year < NUMYEARS; year++) {
float rainfall_sum=0;
for (int month=0; month< NUMMONTHS; month++) {
rainfall_sum += Raindata[year][month];
printf(“%st %5.2fn”, years[year], rainfall_sum);
Program:
#define NUMMONTHS 12
#define NUMYEARS 5
#include
// function prototypes
void inputdata();
void printdata();
void printaggregatedata();
// Global variables
// These are available to all functions
float Raindata[NUMYEARS][NUMMONTHS];
float Winddata[NUMYEARS][NUMMONTHS];
char years[NUMYEARS][5] = {“2011″,”2012″,”2013″,”2014″,”2015”};
char months[NUMMONTHS][12] = {“Jan”,”Feb”,”Mar”,”Apr”,”May”,”Jun”,”Jul”,”Aug”,”Sep”,”Oct”,”Nov”,”Dec”};
char enterData = ‘y’;
printf(“Enter data? = n”);
scanf(“%c”,&enterData);
if (enterData == ‘y’) {
// Call Function to Input data
inputdata();
// Call Function to display data
printdata(
// Call Function to determine the aggregate in each year
printaggregatedata();
printf(“No data was input at this timen”);
printf(“Please try the Precipitation program again. n”);
return 0;
// function to inputdata
void inputdata() {
/* variable definition: */
float Rain=1.0;
float Wind=1.0;
// Input Data
for (int year=0;year < NUMYEARS; year++) {
for (int month=0; month< NUMMONTHS; month++) {
printf(“Enter rain for %d, %d:n”, year+1, month+1);
scanf(“%f”,&Rain);
Raindata[year][month]=Rain;
printf(“Enter wind for %d, %d:n”, year+1, month+1);
scanf(“%f”,&Wind);
Winddata[year][month]=Wind;
// Function to printdata
void printdata(){
// Print data
printf (“yeart montht raint windn”);
for (int year=0;year < NUMYEARS; year++) {
for (int month=0; month< NUMMONTHS; month++) {
printf(“%st %st %5.2ft %5.2fn”,
years[year],months[month],Raindata[year][month], Winddata[year][month]);
// Function to printaggregatedata
void printaggregatedata(){
printf(“nThe Sum of rainfall and wind for each year is given below:n”);
printf (“yeart sum_of_rainfallt sum_of_windn”);
for (int year=0;year < NUMYEARS; year++) {
float rainfall_sum=0;
float wind_sum=0;
for (int month=0; month< NUMMONTHS; month++) {
rainfall_sum += Raindata[year][month];
wind_sum += Winddata[year][month];
f(“%st %5.2fttt %5.2fn”, years[year], rainfall_sum, wind_sum);
Solution:
The lower value for the NUMMONTHS and NUMYEARS definitions is 1. On having the values less than their limit 1, a message is displayed to the user as shown below.
The updated code that takes care of the lower and higher value of number of months and years is given below.
Program:
#define NUMMONTHS 12
#define NUMYEARS 6
#include
// function prototypes
void inputdata();
void printdata();
void printaggregatedata();
// Global variables
// These are available to all functions
float Raindata[NUMYEARS][NUMMONTHS];
float Winddata[NUMYEARS][NUMMONTHS];
char years[NUMYEARS][5] = {“2011″,”2012″,”2013″,”2014″,”2015”};
char months[NUMMONTHS][12] = {“Jan”,”Feb”,”Mar”,”Apr”,”May”,”Jun”,”Jul”,”Aug”,”Sep”,”Oct”,”Nov”,”Dec”};
int main ()
char enterData = ‘y’;
printf(“Enter data? = n”);
scanf(“%c”,&enterData);
if (enterData == ‘y’)
if(NUMMONTHS > 0 && NUMYEARS > 0)
if(NUMMONTHS <=12 && NUMYEARS <= 5)
// Call Function to Input data
inputdata();
// Call Function to display data
printdata();
// Call Function to determine the aggregate in each year
printaggregatedata();
else {
printf(“The number of years and months can be respectively be atmost 5 and 12 only.n”);
void printdata(){
// Print data
printf (“yeart montht raint windn”);
for (int year=0;year < NUMYEARS; year++) {
for (int month=0; month< NUMMONTHS; month++) {
printf(“%st %st %5.2ft %5.2fn”,
years[year],months[month],Raindata[year][month], Winddata[year][month])
// Function to printaggregatedata
void printaggregatedata(){
printf(“nThe Sum of rainfall and wind for each year is given below:n”);
printf (“yeart sum_of_rainfallt sum_of_windn”);
for (int year=0;year < NUMYEARS; year++) {
float rainfall_sum=0;
float wind_sum=0;
for (int month=0; month< NUMMONTHS; month++) {
rainfall_sum += Raindata[year][month];
wind_sum += Winddata[year][month];
printf(“%st %5.2fttt %5.2f n”, years[year], rainfall_sum, wind_sum);
Essay Writing Service Features
Our Experience
No matter how complex your assignment is, we can find the right professional for your specific task. Contact Essay is an essay writing company that hires only the smartest minds to help you with your projects. Our expertise allows us to provide students with high-quality academic writing, editing & proofreading services.Free Features
Free revision policy
$10Free bibliography & reference
$8Free title page
$8Free formatting
$8How Our Essay Writing Service Works
First, you will need to complete an order form. It's not difficult but, in case there is anything you find not to be clear, you may always call us so that we can guide you through it. On the order form, you will need to include some basic information concerning your order: subject, topic, number of pages, etc. We also encourage our clients to upload any relevant information or sources that will help.
Complete the order formOnce we have all the information and instructions that we need, we select the most suitable writer for your assignment. While everything seems to be clear, the writer, who has complete knowledge of the subject, may need clarification from you. It is at that point that you would receive a call or email from us.
Writer’s assignmentAs soon as the writer has finished, it will be delivered both to the website and to your email address so that you will not miss it. If your deadline is close at hand, we will place a call to you to make sure that you receive the paper on time.
Completing the order and download