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 the basis for selection of arrays or pointers as data structure in a program
What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?
What is #pragma statements?
What is printf () in c?
Under what circumstances does a name clash occur?
What is double pointer in c?
Write a program to swap two numbers without using the third variable?
What are the difference between a free-standing and a hosted environment?
What are the different types of data structures in c?
How can I automatically locate a programs configuration files in the same directory as the executable?
What oops means?
Can you assign a different address to an array tag?
How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same
write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?
Write a program which returns the first non repetitive character in the string?