# Write a program that finds the two smallest numbers in an array of n numbers – IGNOU BCA Assignment 2015 – 16

By | October 2, 2015

BACHELOR OF COMPUTER APPLICATIONS

Course Code : BCSL-045
Course Title : Introduction to Algorithm Design Lab
Assignment Number : BCA(IV)/L-045/Assignment/2015
Maximum Marks : 50
Weightage : 25%

Write a program that finds the two smallest numbers in an array of n numbers.

#include<stdio.h>
void main()
{
int I,J,Temp,List[]={6,3,0,4,8,2,5,9,1,7};
clrscr();
printf(“\nElement in Array :\n\n”);
for(J=0;J<10;J++)
{
printf(“%d “,List[J]);
}
for(I=0;I<10;I++)
{
for(J=0;J<=I;J++)
{
if(List[J]>List[I])
{ Temp=List[I];
List[I]=List[J];
List[J]=Temp;
}
}
}
printf(“\n\n\nTwo Smallest numbers :\n\n”);
for(J=0;J<2;J++)
{
printf(“%d “,List[J]);
}
getch();
}

Code:-

 Source code
```c#include<stdio.h>
void main()
{
int I,J,Temp,List[]={6,3,0,4,8,2,5,9,1,7};
clrscr();
printf("\nElement in Array :\n\n");
for(J=0;J<10;J++)
{
printf("%d ",List[J]);
}
for(I=0;I<10;I++)
{
for(J=0;J<=I;J++)
{
if(List[J]>List[I])
{ Temp=List[I];
List[I]=List[J];
List[J]=Temp;
}
}
}
printf("\n\n\nTwo Smallest numbers :\n\n");
for(J=0;J<2;J++)
{
printf("%d ",List[J]);
}
getch();
}```

ScreenShots:-

2. Write a program to generate Fibonacci series of 10 numbers.

Solved program Using Recursion can be found on this link http://cssimplified.com/c-programming/a-c-program-to-find-the-fibonacci-series-of-numbers-using-recursion

Solved program Using NonRecursion can be found on this link http://cssimplified.com/c-programming/design-an-algorithm-draw-a-corresponding-flow-chart-and-write-a-program-in-c-to-print-the-fibonacci-series-10m-jun2006

3. Write a program to reverse a string.

Solved program Using Recursion can be found on this link http://cssimplified.com/c-programming/a-c-program-to-reverse-the-given-string-using-recursion