Enter windspeed for 3 4mph enter windspeed for 3 5mph

Info icon This preview shows pages 14–19. Sign up to view the full content.

View Full Document Right Arrow Icon
Enter WindSpeed for 3, 4:(mph) Enter WindSpeed for 3, 5:(mph) Enter WindSpeed for 3, 6:(mph) Enter WindSpeed for 3, 7:(mph) Enter WindSpeed for 3, 8:(mph) Enter WindSpeed for 3, 9:(mph) Enter WindSpeed for 3, 10:(mph) Enter WindSpeed for 3, 11:(mph) Enter WindSpeed for 3, 12:(mph) Enter WindSpeed for 4, 1:(mph) Enter WindSpeed for 4, 2:(mph) Enter WindSpeed for 4, 3:(mph) Enter WindSpeed for 4, 4:(mph) Enter WindSpeed for 4, 5:(mph) Enter WindSpeed for 4, 6:(mph) Enter WindSpeed for 4, 7:(mph) Enter WindSpeed for 4, 8:(mph) Enter WindSpeed for 4, 9:(mph) Enter WindSpeed for 4, 10:(mph) Enter WindSpeed for 4, 11:(mph) Enter WindSpeed for 4, 12:(mph) Enter WindSpeed for 5, 1:(mph) Enter WindSpeed for 5, 2:(mph) Enter WindSpeed for 5, 3:(mph) Enter WindSpeed for 5, 4:(mph)
Image of page 14

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Enter WindSpeed for 5, 5:(mph) Enter WindSpeed for 5, 6:(mph) Enter WindSpeed for 5, 7:(mph) Enter WindSpeed for 5, 8:(mph) Enter WindSpeed for 5, 9:(mph) Enter WindSpeed for 5, 10:(mph) Enter WindSpeed for 5, 11:(mph) Enter WindSpeed for 5, 12:(mph) year month rain wind 2011 Jan 1.00 1.00 2011 Feb 1.00 1.00 2011 Mar 1.00 1.00 2011 Apr 1.00 1.00 2011 May 1.00 1.00 2011 Jun 1.00 1.00 2011 Jul 1.00 1.00 2011 Aug 1.00 1.00 2011 Sep 1.00 1.00 2011 Oct 1.00 1.00 2011 Nov 1.00 1.00 2011 Dec 1.00 1.00 2012 Jan 1.00 1.00 2012 Feb 1.00 1.00 2012 Mar 1.00 1.00 2012 Apr 1.00 1.00 2012 May 1.00 1.00 2012 Jun 1.00 1.00 2012 Jul 1.00 1.00 2012 Aug 1.00 1.00 2012 Sep 1.00 1.00
Image of page 15
2012 Oct 1.00 1.00 2012 Nov 1.00 1.00 2012 Dec 1.00 1.00 2013 Jan 1.00 1.00 2013 Feb 1.00 1.00 2013 Mar 1.00 1.00 2013 Apr 1.00 1.00 2013 May 1.00 1.00 2013 Jun 1.00 1.00 2013 Jul 1.00 1.00 2013 Aug 1.00 1.00 2013 Sep 1.00 1.00 2013 Oct 1.00 1.00 2013 Nov 1.00 1.00 2013 Dec 1.00 1.00 2014 Jan 1.00 1.00 2014 Feb 1.00 1.00 2014 Mar 1.00 1.00 2014 Apr 1.00 1.00 2014 May 1.00 1.00 2014 Jun 1.00 1.00 2014 Jul 1.00 1.00 2014 Aug 1.00 1.00 2014 Sep 1.00 1.00 2014 Oct 1.00 1.00 2014 Nov 1.00 1.00 2014 Dec 1.00 1.00 2015 Jan 1.00 1.00 2015 Feb 1.00 1.00 2015 Mar 1.00 1.00
Image of page 16

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2015 Apr 1.00 1.00 2015 May 1.00 1.00 2015 Jun 1.00 1.00 2015 Jul 1.00 1.00 2015 Aug 1.00 1.00 2015 Sep 1.00 1.00 2015 Oct 1.00 1.00 2015 Nov 1.00 1.00 2015 Dec 1.00 1.00 sum the rainfall for each year year rain(sum) 2011 12.00 2012 24.00 2013 36.00 2014 48.00 2015 60.00 Please try the Precipitation program again Now If I want to change the input NUMMONTHS=1 and NUMYEARS=1, the following will be the code: The output will be as follows: #define NUMMONTHS 1 #define NUMYEARS 1 #include <stdio.h> void inputdata(); void printdata(); float Raindata[NUMYEARS][NUMMONTHS]; float WindSpeed[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);
Image of page 17
if (enterData == 'y') { inputdata(); printdata(); } else { printf("No data was input at this time\n"); } printf("Please try the Precipitation program again. \n"); return 0; } void inputdata() { 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; } } for (int year=0;year < NUMYEARS; year++) { for (int month=0; month< NUMMONTHS; month++) { printf("Enter WindSpeed for %d, %d:(mph)\n", year+1, month+1); scanf("%f",&Wind); WindSpeed[year][month]=Wind; } } } // Function to printdata void printdata(){ // Print data printf ("year\t month\t rain\t wind\n "); for (int year=0;year < NUMYEARS; year++) { for (int month=0; month< NUMMONTHS; month++) { printf("%s\t %s\t %5.2f\t %5.2f\n", years[year],months[month],Raindata[year] [month],WindSpeed[year][month]); } } printf ("sum the rainfall for each year\n"); printf ("year\t rain(sum)\n"); float sumRain = 0.0;
Image of page 18

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 19
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern