Answer:
#include<stdio.h>
//main function
int main(){
//initialization of variable
char arr1[12][12] = {"January","February","March","April","May","June","July","August","September","October","November","December"};
int arr2[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int i,j;
//for loop for print the arrays
for(i=0;i<12;i++){
for(j=0;arr1[i][j]!='\0';j++){
printf("%c",arr1[i][j]); //for print the months
}
printf(" %d",arr2[i]); //print the days
printf("\\"); //for newline
}
return 0;
}
Step-by-step explanation:
Create the main function and then define the two array with hard-code the month names and number of days in each month.
For defining the string array, you have to take the 2-D array of type 'char'.
then, take nested for loop for print the element in the array.
nested for loop means, loop inside a loop. It is used for the 2-D array. The outer loop is for row and the inner loop is for the column.
For every row, the inside loop print the string character by character with the help of printf() function which is used to display the value on the screen.
after the inner loop terminates, then another prinf() function is used for print the days after the name of the month. Then. the outer loop runs again.
This is process continues until the outer loop not terminate and finally, we get the desired output.