Write a program to find the largest number in a given array of 10 elements.
/* Write a program to find the largest number in a given array of 10 elements*/
#include<stdio.h>
main()
{
int arr[10], size,largest_no,i;
printf("enter the 10 element's size of the Array ");
scanf("%d",&size);
for(i=0;i<size;i++)
scanf("%d",&arr[i]);
largest_no=arr[0];
for(i=0;i<size;i++)
{
if( largest_no<arr[i])
largest_no=arr[i];
}
printf("the largest no of the ten is : %d",arr[i]);
return 0;
}
/* Write a program to find the largest number in a given array of 10 elements*/
#include<stdio.h>
main()
{
int arr[10], size,largest_no,i;
printf("enter the 10 element's size of the Array ");
scanf("%d",&size);
for(i=0;i<size;i++)
scanf("%d",&arr[i]);
largest_no=arr[0];
for(i=0;i<size;i++)
{
if( largest_no<arr[i])
largest_no=arr[i];
}
printf("the largest no of the ten is : %d",arr[i]);
return 0;
}
No comments:
Post a Comment