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 (2254)
 C++ interview questions  C++ Interview Questions (1111)
 VC++ interview questions  VC++ Interview Questions (342)
 Delphi interview questions  Delphi Interview Questions (510)
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions (646)
Question
write a program to find the largest and second largest 
integer from an array
 Question Submitted By :: C
I also faced this Question!!     Answer Posted By  
 
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
 
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
 
for(i=0;i=printf("Hello");i++); printf("Hello"); how many times how will be printed?????????   7
What is the memory allocated by the following definition ? int (*x)[10]; ADITI 4
const char * char * const What is the differnce between the above tow?. TCS 6
CAN WE DEFINE ANY FUNCTION WITHIN A FUNCTION.   15
convert 0.9375 to binary CTS 2
LOGIC OF Bodmas?   1
Why can't we initialise member variable of a strucutre   1
what are threads ? why they are called light weight processes ? what is the relation between process and threads ?   1
int x=sizeof(!5.856); What will value of variable x?   2
Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database TCS 2
write a program to find the given number is prime or not Accenture 2
c programming of binary addition of two binary numbers   3
 
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