#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int large, 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 largest number ...\n\n");
large=array[0];
for(i=0; i<size; i++)
{
if(large<array[i])
{
large=array[i];
}
}
printf("Largest Number = %d",large);
getch();
}
Run:
Previous Next
#include<conio.h>
void main()
{
clrscr();
int large, 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 largest number ...\n\n");
large=array[0];
for(i=0; i<size; i++)
{
if(large<array[i])
{
large=array[i];
}
}
printf("Largest Number = %d",large);
getch();
}
Run:
Previous Next
No comments:
Post a Comment