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 convert an integer into a binary string?
If fflush wont work, what can I use to flush input?
i want the code for printing the output as follows 4 4 3 3 2 2 1 1 0 1 1 2 2 3 3 4 4
#include<stdio.h> void main() { int a=5,b=6,c; int x=(a<b)+7; int y=(x==7)*9; int z=(c=x+y)*2; printf("%h %h %h",x,y,z); } What is the output? Explain it.
A text file that contains declarations used by a group of functions,programs,or users a) executable file b) header file c) obj file d) .cfile
Write a C Program That Will Count The Number Of Even And Odd Integers In A Set using while loop
Efficient data structure for store/search list of 1000 records a)array b)double linked list c)circular queue d)hash table
Write a C program to read the internal test marks of 25 students in a class and show the number of students who have scored more than 50% in the test. Make necessary assumptions.
what is the different bitween abap and abap-hr?
What does the c in ctime mean?
What are keywords in c with examples?
what are the 10 different models of writing an addition program in C language?