ALLInterview.com :: Home Page KalAajKal.com
 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                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
program to find a smallest number in an array
 Question Submitted By :: Pavani
I also faced this Question!!     Rank Answer Posted By  
 
  Re: program to find a smallest number in an array
Answer
# 1
main()
{
 int a[20],n,i,s;
  scanf("%d",&n);
  for(i=0;i<n;i++)
  {
    scanf("%d",&a[i]);
  }
  s=a[0];
  for(i=0;i<n;i++)
  {
    if(s>a[i])
    {
       s=a[i];
    }
  }
  printf("the smallest number is %d",s);
}
 
Is This Answer Correct ?    22 Yes 11 No
Sathish
 
  Re: program to find a smallest number in an array
Answer
# 2
i think this logic would work out...

#include<stdio.h>
#include<conio.h>
void main()
{
int n,a[50],temp;
printf("enter the max limit :");
scanf("%d",&n);
for(int i=0;i<n;i++)
scanf("%d",&a[i]);
i=0;
for(int j=0;j<n-1;j++)
{
if(a[j+1]<a[j])
{
temp=a[j+1];
a[j+1]=a[j];
a[j]=temp;
}
}
printf("the smnallest is : %d",*(a+0));
getch();
}
 
Is This Answer Correct ?    19 Yes 3 No
Vignesh1988i
 
 
 
  Re: program to find a smallest number in an array
Answer
# 3
void main()
{
int a[10];
for(i=0;i<10;i++)
scanf("%d",&a[i]);
for(i=0;i<10;i++)
{
if(a[i]>a[i+1])
{
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
printf("The smallest element is %d",a[0]);
getch();
}
 
Is This Answer Correct ?    2 Yes 1 No
Belsia
 
  Re: program to find a smallest number in an array
Answer
# 4
#include<stdio.h>
#include<conio.h>
void main()
{
int n,a[50],temp;
printf("enter the max limit :");
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
i=0;
for(j=0;j<n-1;j++)
{
if(a[j+1]<a[j])
{
temp=a[j+1];
a[j+1]=a[j];
a[j]=temp;
}
}
printf("the smnallest is : %d",*(a+0));
getch();
}
 
Is This Answer Correct ?    1 Yes 0 No
Rose
 
  Re: program to find a smallest number in an array
Answer
# 5
void main()
{
int a[10];
for(i=0;i<10;i++)
scanf("%d",&a[i]);
for(i=0;i<10;i++)
{
if(a[i]>a[i+1])
{
temp=a[i];
a[i]=a[i+1];
a[i+1]=temp;
}
}
printf("The smallest element is %d",a[0]);
getch();
}
 
Is This Answer Correct ?    0 Yes 0 No
Belsia
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
design and implement a program that reads floating-points numbers in a sentinel-controlled loop until the user terminates the program by entering zero.your program should determinate and print the smallest,largest and average of the supplied numbers.  1
Implement a function that returns the 5th element from the end in a singly linked list of integers in one pass. Microsoft6
Program to find the value of e raised to power x using while loop N-Tech3
array contains zeros and ones as elements.we need to bring zeros one side and one other side in single parse. ex:a[]={0,0,1,0,1,1,0,0} o/p={0,0,0,0,0,1,1,1} Motorola7
consider the following program sigment int n,sum=1; switch(n) { case 2:sum=sum+2; case 3:sum*=2; break; default:sum=0;} if n=2, what is the value of sum a.0 b.6 c.3 d.none TCS4
could u able to tell about suresoft technical session  1
f() { int a=2; f1(a++); } f1(int c) { printf("%d", c); } c=? Geometric-Software2
How can I invoke another program from within a C program?  6
what is volatile in c language? TCS1
write a “Hello World” program in “c” without using a semicolon?  3
how to connect oracle in C/C++.  2
code snippet for creating a pyramids triangle ex 1 2 2 3 3 3  3
what is const volatile?  1
Write a function that accepts two numbers,say a and b and makes bth bit of a to 0.No other bits of a should get changed. Scientific-Atlanta2
What will be printed as the result of the operation below: #include<..> int x; int modifyvalue() { return(x+=10); } int changevalue(int x) { return(x+=1); } void main() { int x=10; x++; changevalue(x); x++; modifyvalue(); printf("First output:%d\n",x); x++; changevalue(x); printf("Second output:%d\n",x); modifyvalue(); printf("Third output:%d\n",x); }  2
we all know about the function overloading concept used in C++ and we all learnt abt that.... but that concept is already came in C in a very smaller propotion ... my question is IN WHICH CONCEPT THERE IS A USE OF FUNCTION OVERLOADING IS USED in C language????????????? Google2
main() { int a = 65; printf(“%d %o %x”,a,a,a); } Output 65 101 41 Please explain me.How it is coming like that? Excel2
please give me answer with details #include<stdio.h> main() { int i=1; i=(++i)*(++i)*(++i); printf("%d",i); getch(); }  3
Result of the following program is main() { int i=0; for(i=0;i<20;i++) { switch(i) case 0:i+=5; case 1:i+=2; case 5:i+=5; default i+=4; break;} printf("%d,",i); } } a)0,5,9,13,17 b)5,9,13,17 c)12,17,22 d)16,21 e)syntax error IBM4
fun(int x) { if(x > 0) fun(x/2); printf("%d", x); } above function is called as: fun(10); what will it print? } NDS13
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com