/* To Interchange the Smallest and Second Smallest of ten numbers using conditional operator
	Step 1: To find smallest of ten numbers
	Step 2: To find smallest position of ten numbers
	Step 3: To find second smallest of ten numbers
	Step 4: To find Second Smallest position of ten numbers
*/
#include<stdio.h>
main()
{
	int i,small,a[10],sma_pos,sec_sma_pos,sec_small;
	clrscr();
	for(i=0;i<10;i++)
	{
		scanf("%d",&a[i]);
	}
	for (i=0,small=a[0],sec_small=a[0];i<10;i++)	// WE can also assign small=sec_small=0 
	{
		small=a[i] < small?a[i]:small;
		sec_small=a[i]!=small && a[i]< sec_small?a[i]:sec_small;
	}
	printf("smallest = %d",small);
	printf("Second Smallest = %d",sec_small);
	getch();
}
/* Exercise: 1. interchanging biggest and smallest number
		input : 2 3 4 5 6 79 8 9 12 76
		output: 79 2 3 4 5 6 8 9 12 76
*/