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 does do in c?
Explain about the constants which help in debugging?
How would you use the functions fseek(), freed(), fwrite() and ftell()?
What is #define in c?
Explain what is a program flowchart and explain how does it help in writing a program?
What is the difference between arrays and pointers?
What is the difference between call by value and call by reference in c?
Explain the term printf() and scanf() used in c language?
cin.ignore(80, _ _);This statement a) ignores all input b) ignores the first 80 characters in the input c) ignores all input till end-of-line d) iteration
How can I list all of the predefined identifiers?
Explain the advantages and disadvantages of macros.
a program that can input number of records and can view it again the record
What is the value of h?
what is a constant pointer in C
Explain what is a stream?