Posts

Showing posts with the label b3

mid sem c practical lab nitk b3 batch qstn 1

#include<stdio.h> void main() {  int array[10];  int n,i,j,temp;  printf("\n enter the no of element you want to insert");  scanf("%d",&n);  printf("\n enter the element");  for(i=0;i<n;i++)  {     scanf("%d",&array[i]);  }  for(i=0;i<n;i++)  {    for(j=1;j<n-i;j++)    {      if(array[i]>array[i+j])      {      temp=array[i];      array[i]=array[i+j];      array[i+j]=temp;   }    }  }  i=0;  printf("array[i]+array[j]=%d",array[i]+array[i+1]); }