#include<stdio.h>
#include<conio.h>
void main()
{
int i,arraySize, arr[10];
clrscr();
printf("Enter Values to Insert Into Arrays \n");
scanf("%d",&arraySize);
for(i=0;i<arraySize;i++)
{
printf("Enter the Number %d:",i+1);
scanf("%d",&arr[i]);
}
for(i=1;i<arraySize;i++)
{
if(arr[0] < arr[i])
arr[0] = arr[i];
}
printf("Largest Number is %d",arr[0]);
getch();
}
To Compile Press Alt+f9
To Run Press Ctrl+f9
Output:
#include<conio.h>
void main()
{
int i,arraySize, arr[10];
clrscr();
printf("Enter Values to Insert Into Arrays \n");
scanf("%d",&arraySize);
for(i=0;i<arraySize;i++)
{
printf("Enter the Number %d:",i+1);
scanf("%d",&arr[i]);
}
for(i=1;i<arraySize;i++)
{
if(arr[0] < arr[i])
arr[0] = arr[i];
}
printf("Largest Number is %d",arr[0]);
getch();
}
To Compile Press Alt+f9
To Run Press Ctrl+f9
Output:
No comments:
Post a Comment