find largest element in array w/o using sorting techniques.
Answers were Sorted based on User's Feedback
Answer / pramod
#include<stdio.h>
int main()
{
int a[10]={13,12,34,56,73,21,234,5,76,2};
int tmp,i;
tmp=a[0];
for(i=0;i<=9;i++)
{
if(a[i]>tmp)
{
tmp=a[i];
}
}
printf("\n largest number is %d\n",tmp);
return 0;
}
| Is This Answer Correct ? | 27 Yes | 2 No |
Answer / 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 |
Answer / manjunath
#include<stdio.h>
void main()
{
int a,b[4]={3,2,7,4,9};
a[0]=b[0];
for(i=1;i<5;i++)
{
if(a<b[i])
{
a=b[i];
}
}
printf("the largest num is %d",a);
}
| Is This Answer Correct ? | 3 Yes | 7 No |
write a c program to print "Welcome" without using semicolon in the whole program ??
two variables are added answer is stored on not for third variable how it is possible?
Write programs for String Reversal & Palindrome check
What are different storage class specifiers in c?
main() { intx=2,y=6,z=6; x=y=z; printf(%d",x) }
5 Answers Amazon, HCL, Thought Works,
How many levels of indirection in pointers can you have in a single declaration?
0 Answers Agilent, ZS Associates,
change to postfix a/(b+c*d-e)
What is the code for 3 questions and answer check in VisualBasic.Net?
What is difference between scanf and gets?
What is static and volatile in c?
What is the difference between CV and Resume ?
Explain what is the concatenation operator?