-->

NEB23;program to sort 'n' number in ascending order

//program to sort 'n' elements in ascending order
  #include<stdio.h>
  #include<conio.h>
  void main()
  {
  clrscr();
  int arr[200];    
  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++)
   {
       for(j=i+1;j<size;j++)
        {
           if(arr[i]>arr[j])
             {
                 k=arr[i];
                 arr[i]=arr[j];
                arr[j]=k;
             }
       }
}
printf("in ascending order,elements are\n");
for(i=0;i<size;i++)
   {                            
     printf("%d\n",arr[i]);      
   }
getch();
}

NEB23;program to sort any 'n' names

//program to sort 'n' elements 
  #include<stdio.h>
  #include<conio.h>
  void main()
  {
  clrscr();
  int arr[200][200],temp;    
  int size;     
  int i,j;      
 printf("enter size of string \n");
  scanf("%d",&size); 
printf("enter strings\n");                 
  for(i=0;i<size;i++)
   {                            
     printf("enter string for location=%d\n",i);
     scanf("%s",&arr[i]);      
   }
   printf("elements' sorting process started\n");
   for(i=0;i<size;i++)
   {
       for(j=i+1;j<size;j++)
        {
           if((strcmp(arr[i],arr[j]))>0)
             {
                 strcpy(temp,arr[i]);
                 strcpy(arr[i],arr[j]);
                strcpy(arr[j],temp);
             }
       }
}
printf("in ascending order,elements are\n");
for(i=0;i<size;i++)
   {                            
     printf("%s\n",arr[i]);      
   }
       
 printf("in descending order....\n");

for(i=0;i<size;i++)
   {
       for(j=i+1;j<size;j++)
        {
           if((strcmp(arr[i],arr[j]))<0)
             {
                 strcpy(temp,arr[i]);
                 strcpy(arr[i],arr[j]);
                strcpy(arr[j],temp);
             }
       }
}
printf("in descending order,elements are\n");
for(i=0;i<size;i++)
   {                            
     printf("%s\n",arr[i]);      
   }   
 getch();
}

Neb22:program to get difference of two matrices of order mxn

//program to get difference of two matrices of order mxn
#include<stdio.h>
#include<conio.h>
void main()
{
int matrics_1[100][100],matrics_2[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 first 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 for second matrix\n");
for(i=0;i<total_row;i++)
{
  for(j=0;j<total_col;j++)
       {
           scanf("%d",&matrics_2[i][j]);
        }
}
 printf("the summed matrix is\n");
for(i=0;i<total_row;i++)
{
  for(j=0;j<total_col;j++)
       {
           printf("%d",matrics_1[i][j]-matrics_2[i][j]);
        }
      printf(\n");
}
getch();

hseb21:;program to get sum of two matrices of order mxn

///program to get sum of two matrices of order mxn
#include<stdio.h>
#include<conio.h>
void main()
{
int matrics_1[100][100],matrics_2[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 first 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 for second matrix\n");
for(i=0;i<total_row;i++)
{
  for(j=0;j<total_col;j++)
       {
           scanf("%d",&matrics_2[i][j]);
        }
}
 printf("the summed matrix is\n");
for(i=0;i<total_row;i++)
{
  for(j=0;j<total_col;j++)
       {
           printf("%d",matrics_1[i][j]+matrics_2[i][j]);
        }
      printf(\n");
}
getch();
}



hseb20:program to get maximum and minimum value

//program to get maximum and minimum value
#include<stdio.h>
#include<conio.h>
void main()
{
int a[200],size,i,max,min;
printf("enter value of size to be stored in array\n");
scanf("%d",&size);
for(i=0;i<size;i++)
{
   printf("enter value for location=%d",i);
   scanf("%d",&a[i]);
}
max=a[2];
min=a[1];
for(i=0;i<size;i++)
{
   if(max<a[i])
     {
       max=a[i];
     }
 else if (min>a[i])
   {
     min=a[i];
    }
}
printf("the maximum value=%d\n",max);
printf("the minimum value=%d\n",min);
getch();
}


hseb19 solution:program to do different operation using switch

//program to carry out different operation  using switch.
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int choice;
int length_rect,breadth_rect;
char string[200];
printf("'we have following menu\n");
printf( "1.to get length of string\n");
printf("2. to get area of rectangle\n");
printf("3 to reverse a string\n");
printf("4 exit");
printf("enter your choice 1 or 2 or 3 or 4\n");
scanf("%d",&choice);
 switch(choice)
          {
                  case 1:
                            printf("we are going to get length of string\n");
                            printf("enter string\n");
                            gets(string);
                           printf("the length=%d",strlen(string));
                 break;
               case 2:
                            printf("we are going to get area of rectangle\n");
                            printf("enter its length and breadth\n");
                            scanf("%d%d",&length_rect,&breadth_rect);
                            printf("the area=%d",length_rect*breadth_rect);
                 break;

               case 3:
                            printf("we are going to reverse the string\n");
                            printf("enter your string\n");
                            gets(string);
                           printf("the reverse=%s",strrev(string));
                 break;
             case 4:
                            printf("we are going to exit\n");
                 break;

              default:
                            printf("sorry, not a valid input\n");
                            printf("thank u, terminating....\n");
          }
getch();
}

hseb sol17:program to get all even numbers lying between 1 and 100

//program  to print/display all even numbers lying between 1 and 100.
#include<stdio.h>
#include<conio.h>
void main()
{
int k,n;
printf("enter value of 'n'\n");
scanf("%d",&n);
for(k=1;k<=n;k++)
   {
     if(k%2==0)
      {      printf("%d,",k);
      }
  }
getch();
}