In: Computer Science
Write a C program that generates the following 2D array.
64   32   16   8  
4   2   1
32   32   16   8  
4   1   1
16   16   16   8  
4   2   1
8   8   8   8  
4   2   1
4   4   4   4  
4   2   1
2   2   2   2  
2   2   1
1   1   1   1  
1   1   1
SOURCE CODE:
*Please follow the comments to better understand the code.
**Please look at the Screenshot below and use this code to copy-paste.
***The code in the below screenshot is neatly
indented for better understanding.
#include <stdio.h>
int main() {
   // declare the array
   int arr[7][7];
   int i,j,k,num=64,temp;
  
   // use two loops
   for(i=0;i<7;i++)
   {
   temp=num;
   for(j=0;j<i;j++)
   {
   arr[i][j]=temp;
   }
   for(k=j;k<7;k++)
   {
   // store temp value
   if(temp>0)
   arr[i][k]=temp;
   else
   arr[i][k]=1;
     
   // update the temp value
   temp /= 2;
   }
   num /=2 ;
   }
  
   // print the 2-d array
   printf("The Stored 2d array is:\n");
   for(i=0;i<7;i++)
   {
   for(j=0;j<7;j++)
   {
   printf("%d ",arr[i][j]);
   }
   printf("\n");
   }
   return 0;
}
============
SCREENSHOT FOR CODE:

