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
How can I read data from data files with particular formats?
What is array of structure in c programming?
What does *p++ do?
a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above
What is mean by Data Driven framework in QTP? Can any one answer me in details on this regard.
Here is a neat trick for checking whether two strings are equal
Design a program which assigns values to the array temperature. The program should then display the array with appropriate column and row headings.
Explain how to reverse singly link list.
Explain the difference between strcpy() and memcpy() function?
write a c program to find the sum of five entered numbers using an array named number
Difference between constant pointer and pointer to a constant.
Why enum is used in c?
What is wrong with this initialization?
What are Macros? What are its advantages and disadvantages?
What are the keywords in c?