Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int num[10]={5,4,3,7,1,150,45,1547,857,2};
- int i=0,j=0,temp=0,k=0;
- for(i=0;i<=9;i++)
- {
- for(j=i+1;j<=9;j++)
- {
- if(num[i]>num[j])
- {
- temp=num[i];
- num[i]=num[j];
- num[j]=temp;
- }
- }
- }
- printf("The array is\t");
- for(k=0;k<=9;k++)
- {
- printf("%d ",num[k]);
- }
- printf("\nThe largest element in the list is %d",num[9]);
- printf("\n\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement