# C Program to find sum greater Number in 10 numbers

#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],i,g=0;
clrscr();
printf("Enter numbers:");
for(i=0;i<=9;i++)
{
printf("\nEnter number %d:",i+1);
scanf("%d",&a[i]);
}
for(i=0;i<=9;i++)
{
if(a[i]>g)
{
g=a[i];
}
}
printf("Greatest number is:%d",g);
getch();
}

## Explanation:

On execution of the above program you will get the greatest number among the ten numbers present in array. There is a integer array 'arr[]' of size 10.This array contains ten integer type values. These values are entered by the user on run time with the help of scanf statement. Conditional if statement checks the greatest value among these 10 values and prints the greatest value present in variable g with the help of printf statement. You can understand this process with the help of this example:

g=0
number 1=arr[0]=2
number 2=arr[1]=2
number 3=arr[2]=1
number 4=arr[3]=3
number 5=arr[4]=10
number 6=arr[5]=9
number 7=arr[6]=0
number 8=arr[7]=6
number 9=arr[8]=10
number 10=arr[9]=90
iteration 1:
i=0
arr[i]>g=2>0 true
so g=arr[i]=arr[0]
iteration 2:
i=1
arr[i]>g=2>2 false
so iteration 3:
i=2
arr[i]>g=1>2 false
so iteration 4:
i=3
arr[i]>g=3>2 true
so g=arr[i]=arr[3]=3
iteration 5:
i=4
arr[i]>g=10>3 true
so g=arr[i]=arr[4]=10
iteration 6:
i=5
arr[i]>g=9>10 false
so iteration 7:
i=6
arr[i]>g=0>10 false
so iteration 8:
i=7
arr[i]>g=6>10 false
so iteration 9:
i=8
arr[i]>g=10>10 false
so iteration 10:
i=9
arr[i]>g=90>10 true
so g=arr[i]=arr[9]=90
now i=10 >9 so condition get false loop break and greatest value is
g=90
The output of the above program is given below: