ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Google
   
 
Categories >> Software >> Programming Languages >> C
 
 


 

 
 C interview questions  C Interview Questions (2248)
 C++ interview questions  C++ Interview Questions (1106)
 VC++ interview questions  VC++ Interview Questions (342)
 Delphi interview questions  Delphi Interview Questions (510)
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions (644)
Question
write a program to find the largest and second largest 
integer from an array
 Question Submitted By :: Chandrasekhar
I also faced this Question!!     Rank Answer Posted By  
 
  Re: write a program to find the largest and second largest integer from an array
Answer
# 1
#include<stdio.h>
#include<conio.h>
void main()
{
int a[5],x,y,c;
for (x=0;x<5;x++)
{
printf("enter any number");
scanf("%d",&a[x]);
}
for (x=0;x<5;x++)
{
for (y=0;y<4;y++)
{
if (a[y]>a[y+1])
{
c=a[y];
a[y]=a[y+1];
a[y+1]=c;
}
}
}
printf("\nlargest no:-%d",a[y]);
printf("\nsecond largest no:-%d",a[y-1]);
getch();
}
 
Is This Answer Correct ?    15 Yes 7 No
Manish Gupta
 
  Re: write a program to find the largest and second largest integer from an array
Answer
# 2
use bubble sort next to this, print last n second from last.. 
Is This Answer Correct ?    1 Yes 1 No
Mahesh
 
 
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
what is a far pointer TCS 12
post new interiew question and aptitude test papers   1
1.write a program to merge the arrays 2.write efficient code for extracting unique elements from a sorted list of array? Qualcomm 3
increment operateor (++)and decrament(--) #include<stdio.h> #inclide<conio.h> main() { int x=15; while(x!=0) scanf("%d",&x); { TCS 2
How Many Header Files in c? TCS 1
5) Write a program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or if it is not prime find out its factors.without using big int and exponential function TCS 1
how can i calculate mean,median,mode by using c program HCL 1
Write a program which calculate sum of several number and input it into an array. Then, the sum of all the number in the array is calculated.   2
can any one tell that i have a variable which is declared as static but i want this variable to be visible to the other files? how?   2
what is differnence b/w macro & functions   1
how to find out the union of two character arrays?   2
main() { printf(5+"good morning"); printf("%c","abcdefgh"[4]); }the o/p is morning and e...how someone explain   1
 
For more C Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com