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 |
How can you draw circles in C?
write a program to display the frequency of each element in a given array in c language
in multiple branching construct "default" case is a) optional b) compulsarily c) it is not include in this construct d) none of the above
f(char *p) { p=(char *)malloc(sizeof(6)); strcpy(p,"HELLO"); } main() { char *p="BYE"; f(p) printf("%s",p); } what is the output?
9 Answers Hughes, Tech Mahindra,
i have a written test for microland please give me test pattern
What is the difference between big endian form and little endian form? write a code to convert big endian form to little endian and vice versa..
What is the best way to comment out a section of code that contains comments?
34.what are bitwise shift operators? 35.what are bit fields? What is the use of bit fields in a structure declaration? 36.what is the size of an integer variable? 37.what are the files which are automatically opened when a c file is executed? 38.what is the little endian and big endian? 39.what is the use of fflush() function? 40.what is the difference between exit() and _exit() functions? 41.where does malloc() function get the memory? 42.what is the difference between malloc() and calloc() function? 43.what is the difference between postfix and prefix unary increment operators?
in programming languages a statement or part of a statement that specifies several different execution sequences a) constructs b) distructs c) executes d) none
Why do u use # before include in a C Progam?
code for selection sort?
How main function is called in c?