Please write the attached C Programming assignments and subm

Please write the attached \'C\' Programming assignments and submit c files and word/text docs are documented in the detailed instructions below. Thank you so much

****All programs must be written using the VC++ 2015 compiler****

A) Required Items/Software:

Visual C++ 2015 (Visual Studio 2015 Professional or Visual Studio Express 2015)

MS Word or Notepad WinZip (or similar)- for extracting files

6. One can find out date of the month when someone was born by asking five questions. Each question asks whether the day is in one of the five sets of numbers below: 8 9 10 11 16 17 18 19 3 5 7 2 3 6 7 4 5 6 7 1 9 11 13 15 10 11 14 15 12 13 14 15 12 13 14 15 20 21 22 23 17 19 21 23 18 19 22 23 20 21 22 23 24 25 26 27 24 25 26 27 25 27 29 31 26 27 30 31 28 29 30 31 28 29 30 31 28 29 30 31 Set 4 Set 3 Set 2 Set 5 Set1

Solution

Please find the required program and output below: Please find the comments against each line for the description:

#include \"stdio.h\"

printArray(int arr[4][4]){
   printf(\"\ \");
   for(int i=0; i<4; i++){
       for(int j=0; j<4; j++){
           printf(\"%d\\t\",arr[i][j]);
       }
       printf(\"\ \");
   }
   printf(\"Enter 0 for No and 1 for Yes: \");
}

int main(void) {
   //initialize the arrays
   int set1[4][4] = {1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31};
   int set2[4][4] = {2,3,6,7,10,11,14,15,18,19,22,23,26,27,30,31};
   int set3[4][4] = {4,5,6,7,12,13,14,15,24,25,26,27,28,29,30,31};
   int set4[4][4] = {8,9,10,11,12,13,14,15,24,25,26,27,26,29,30,31};
   int set5[4][4] = {16,17,18,19,20,21,22,23,24,25,26,27,26,29,30,31};
   int o,sum=0;
  
   //print the set1 and read user input
   printf(\"Is your birth day in set 1?\");
   printArray(set1);
   scanf(\"%d\",&o);
   if(o == 1)   //if user input is 1, then add the first element in set 1 to sum
       sum = sum + set1[0][0];

   //print the set2 and read user input
   printf(\"Is your birth day in set 2?\");
   printArray(set2);
   scanf(\"%d\",&o);
   if(o == 1)   //if user input is 1, then add the first element in set 2 to sum
       sum = sum + set2[0][0];

   //print the set3 and read user input
   printf(\"Is your birth day in set 3?\");
   printArray(set3);
   scanf(\"%d\",&o);
   if(o == 1)   //if user input is 1, then add the first element in set 3 to sum
       sum = sum + set3[0][0];

   //print the set4 and read user input
   printf(\"Is your birth day in set 4?\");
   printArray(set4);
   scanf(\"%d\",&o);
   if(o == 1)   //if user input is 1, then add the first element in set 4 to sum
       sum = sum + set4[0][0];
  
   //print the set5 and read user input
   printf(\"Is your birth day in set 5?\");
   printArray(set5);
   scanf(\"%d\",&o);
   if(o == 1)   //if user input is 1, then add the first element in set 5 to sum
       sum = sum + set5[0][0];
      
   printf(\"Your birth day is: %d\",sum);
return 0;
}

--------------------------------------------------

OUTPUT:

Please write the attached \'C\' Programming assignments and submit c files and word/text docs are documented in the detailed instructions below. Thank you so mu
Please write the attached \'C\' Programming assignments and submit c files and word/text docs are documented in the detailed instructions below. Thank you so mu

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site