-->

WAP to get sum of elements of first row of a matrix of order 'mxn'.

//WAP to get sum of elements of first row of a matrix of order 'mxn'.
#include<stdio.h>
#include<conio.h>
void main()
{
int matrics_1[100][100];
int i,j,sum=0;
int total_row,total_col;
printf("enter total number of rows(m)\n");
scanf("'%d",&total_row);
printf("'enter total columns(n)\n");;
scanf("%d",&total__col);
printf("enter elements of matrix\n");
for(i=0;i<=0;i++)                            // for rows
{
  for(j=0;j<total_col;j++)                // for columns
       {
           scanf("%d",&matrics_1[i][j]);
           sum=sum+matrics_1[i][j];
        }
}


           printf("sum=%d",sum);
     
getch();
}



WAP to get sub-matrix of a matrix of order 'mxn'.

//WAP to get sub-matrix of a matrix of order 'mxn'.
#include<stdio.h>
#include<conio.h>
void main()
{
int matrics_1[100][100];
int i,j,sum=0;
int total_row,total_col;
int sub_row,sub_col;
printf("enter total number of rows(m)\n");
scanf("'%d",&total_row);
printf("'enter total columns(n)\n");;
scanf("%d",&total__col);
printf("enter elements of matrix\n");
for(i=0;i<total_row;i++)
{
  for(j=0;j<total_col;j++)
       {
           scanf("%d",&matrics_1[i][j]);
         
        }
}
printf("now enter total rows and columns to be \n");
printf("enter total number of rows(m)\n");
scanf("'%d",&sub_row);
printf("'enter total columns(n)\n");;
scanf("%d",&sub__col);
for(i=0;i<sub_row;i++)
{
  for(j=0;j<sub_col;j++)
       {
           printf("%d",matrics_1[i][j]);
         
        }

     printf("\n");
}     
getch();
}



WAP to get sum of elements of an array of order 'mxn'.

//WAP to get sum of elements of an array of order 'mxn'.
#include<stdio.h>
#include<conio.h>
void main()
{
int matrics_1[100][100];
int i,j,sum=0;
int total_row,total_col;
printf("enter total number of rows(m)\n");
scanf("'%d",&total_row);
printf("'enter total columns(n)\n");;
scanf("%d",&total__col);
printf("enter elements of matrix\n");
for(i=0;i<total_row;i++)
{
  for(j=0;j<total_col;j++)
       {
           scanf("%d",&matrics_1[i][j]);
           sum=sum+matrics_1[i][j];
        }
}


           printf("sum=%d",sum);
       
getch();
}


WAP to initialize elements of an array of size 2x2. Then display that.

//WAP to initialize elements of an array of size 2x2. Then display that.
#include <stdio.h>
#include<conio.h>

void main()
{
    int a[2][2]={1,2,3,4};
    int i,j;
    for(i=0;i<=1;i++)
    {
        for(j=0;j<=1;j++)
        {
            printf("%d",a[i][j]);
        }
    
     printf("\n");
  }
    getch();
}


-----------------------------------------------------------------------------------
or
----------------------------------------------------------------------------------------------------------
#include <stdio.h>
#include<conio.h>
void main()
{
    int a[2][2]={{1,2},{3,4}};
    int i,j;
    for(i=0;i<=1;i++)
    {
        for(j=0;j<=1;j++)
        {
            printf("%d",a[i][j]);
        }
    
    printf("\n");
}
    getch();
}

WAP to input values for matrix of order 2x2 and display that.

//WAP to input values for matrix of order 2x2 and display that.
#include<stdio.h>
#include<conio.h>
void main()
{
int matrics[100][100];
int i,j;
int total_row,total_col;
printf("enter total number of rows(m)\n");
scanf("'%d",&total_row);
printf("'enter total columns(n)\n");;
scanf("%d",&total__col);
printf("enter elements of matrix\n");
for(i=0;i<total_row;i++)
{
  for(j=0;j<total_col;j++)
       {
           scanf("%d",&matrics[i][j]);
        }
}
 printf("the matrix is\n");
for(i=0;i<total_row;i++)
{
  for(j=0;j<total_col;j++)
       {
           printf("%d",matrics[i][j]);
        }
      printf(\n");
}
getch();
}
------------------------------------------
or
-----------------------------------
/WAP to input values for matrix of order 2x2 and display that.
#include<stdio.h>
#include<conio.h>
void main()
{
int matrics[2][2];
int i,j;
printf("enter elements of matrix\n");
for(i=0;i<2;i++)
{
  for(j=0;j<2;j++)
       {
           scanf("%d",&matrics[i][j]);
        }
}
 printf("the matrix is\n");
for(i=0;i<2;i++)
{
  for(j=0;j<2;j++)
       {
           printf("%d",matrics[i][j]);
        }
      printf(\n");
}
getch();
}

program to know repetition of elements stored in array.

using turbo C++
-----------------------------------------------------------------------
//program to know repetition of elements stored in array.
#include<stdio.h>
#include<conio.h>
  void main()
  {
  clrscr();
  int arr[200],arr1[200],arra2_rep;    
  int size;     
  int i,j,k;      
 printf("enter size of elements \n");
  scanf("%d",&size); 
printf("enter array's elements\n");                 
  for(i=0;i<size;i++)
   {                            
     printf("enter elements for location=%d\n",i);
     scanf("%d",&arr[i]);      
   }
   printf("elements' sorting process started\n");
   for(i=0;i<size;i++)
   {
        arra2_rep=0;       for(j=i+1;j<size;j++)
        {
           if(arr[i]==arr[j])
             {
                 arr1[i]=ara2_rep++;
             }
       }
}
printf("repeated numbers are\n");
for(i=0;i<size;i++)
   {                            
     printf("number=%d and repeated times=%d\n",arr[i],arra1_rep[i]);      
   }
getch();
}

-------------------------------------------------------------------------------------------
in codeblocks
----------------------

//program to know repetition of elements stored in array.
#include<stdio.h>
  int main()
  {
  int arr[200],arr1[200],arra2_rep;    
  int size;     
  int i,j,k;      
 printf("enter size of elements \n");
  scanf("%d",&size); 
printf("enter array's elements\n");                 
  for(i=0;i<size;i++)
   {                            
     printf("enter elements for location=%d\n",i);
     scanf("%d",&arr[i]);      
   }
   printf("elements' sorting process started\n");
   for(i=0;i<size;i++)
   {

        arra2_rep=0;
       for(j=i+1;j<size;j++)
        {
           if(arr[i]==arr[j])
             {
                 arra2_rep++;
                 arr1[i]=arra2_rep;
             }
       }
}
printf("repeated numbers are\n");
for(i=0;i<size;i++)
   {                            
     printf("number=%d and repeated times=%d\n",arr[i],arr1[i]);      
   }
return 0;

}

Write a program to show initialization of element in an array

using turbo c++
--------------------------------------------------------------------------------------------------
//Write a program to show initialization of element in an array
#include<stdio.h>
#include<conio.h>
void main()
{
float arr[4]={1,2,3,4},k;                                                                        // array declaration with 4 elements
                                                                                                         // can also be written as arr[]
printf("elements are\n");
for(k=0;k<=3;k++)
{
   printf(" element for location=%d is\n",k);                               // for elements in particular location
   printf("%f",arr[k]);
}
getch();
}

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

using codeblocks or dev c++/online compiler
---------------------------------------------------------------------------------------------------------------------------------------
//Write a program to show initialization of element in an array

#include<stdio.h>
int main()
{
float arr[4]={1,2,3,4},k;                                                                        // array declaration with 4 elements
                                                                                                         // can also be written as arr[]
printf("elements are\n");
for(k=0;k<=3;k++)
{
   printf(" element for location=%d is\n",k);                               // for elements in particular location
   printf("%f",arr[k]);
}
return 0;
}