Computer Science, asked by sharanya200636, 9 months ago

WAP to declare a 1D array, array size and elements accept from the user . Then
display the largest set of consecutive elements in array with their range of
subscript. [ Sample input: size : 12, elements : 9,2,3,4,5,7,5,6,7, 23, 8,9 output
: 2, 3, 4,5 subscript: 1 to 4 ] methods and variable use as required. [12 MARKS]​

Answers

Answered by rushilansari
1

Answer:

#include <stdio.h>

int main()

{

   //we initialize the first array and the second array will have user input values

   int a[3][3]={{1,34,5},{7,0,15},{23,4,6}};//first array initialization

   int b[3][3],c[3][3],i,j;

   

   printf("Enter values in the 3x3 array:\n");

   

   for(i=0 ;i<3 ;i++){ //outer loop for rows

       for(j=0 ;j<3 ;j++){  //inner loop for columns

           scanf("%d",&b[i][j]);

           c[i][j]=a[i][j]+b[i][j];//summing up the values of the two arrays

       }

   }

   

   //displaying the array elements after summing up

   for(i=0 ;i<3 ;i++){

       for(j=0 ;j<3 ;j++){

               printf("%d  ",c[i][j]);

       }

       printf("\n");

   }

   return 0;

}

HOPE IT HELPS IF YES PLEASE MARK THE BRAINLIEST

Similar questions