#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int small, array[50], size, i;
printf("Enter Array Size : ");
scanf("%d",&size);
printf("\n Enter array elements : ");
for(i=0; i<size; i++)
{
scanf("%d",&array[i]);
}
printf("Searching for smallest number ...\n\n");
small=array[0];
for(i=0; i<size; i++)
{
if(small>array[i])
{
small=array[i];
}
}
printf("Smallest Number = %d",small);
getch();
}
Run:
Previous Next
#include<conio.h>
void main()
{
clrscr();
int small, array[50], size, i;
printf("Enter Array Size : ");
scanf("%d",&size);
printf("\n Enter array elements : ");
for(i=0; i<size; i++)
{
scanf("%d",&array[i]);
}
printf("Searching for smallest number ...\n\n");
small=array[0];
for(i=0; i<size; i++)
{
if(small>array[i])
{
small=array[i];
}
}
printf("Smallest Number = %d",small);
getch();
}
Run:
Previous Next
No comments:
Post a Comment