find largest element in array w/o using sorting techniques.
Answer Posted / gganesh
#include<stdio.h>
#include<conio.h>
#define max 100
void main()
{
int i,j,k,num[max];
clrscr();
printf("\nEnter the number one by one and terminate with
0\nDont enter more than %d numbers\n\n",max);
i=0;
do
{
printf("Enter the number : ");
scanf("%d",&num[i]);
i++;
}while(num[i-1]!=0);
j=num[0];
for(k=1;k<i;k++)
if(j<num[k])
j=num[k];
printf("\nLargest number : %d",j);
getch();
}
Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
What is meant by preprocessor in c?
The number of measuring units from an arbitarary starting point in a record,area,or control block to some other point a) recording pointer b) offset c) branching d) none
Explain the difference between ++u and u++?
What is an operator?
List some of the static data structures in C?
Describe how arrays can be passed to a user defined function
How are strings stored in c?
What are the 5 types of inheritance in c ++?
What is c++ used for today?
how can i access hard disk address(physical address)? are we access hard disk by using far,near or huge pointer? if yes then please explain.....
Explain how do you determine a file’s attributes?
Are negative numbers true in c?
Why do we write return 0 in c?
What are dangling pointers? How are dangling pointers different from memory leaks?
What should malloc(0) do?