program to find a smallest number in an array

Answer Posted / anu

#include<iostream.h>
#include<conio.h>
void main()
{
int a[20],n,i,s;
clrscr();
cout<<"Enter valur of n";
cin>>n;
cout<<"Enter the elements";
for(i=0;i<n;i++)
{
cin>>a[i];
}
s=a[0];
for(i=0;i<n;i++)
{
if(s>a[i])
{
s=a[i];
}
}
cout<<"The smallest number is"<<s
getch();
}

Is This Answer Correct ?    10 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

If a five digit number is input through the keyboard, write a program to print a new number by adding one to each of its digits.For example if the number that is input is 12391 then the output should be displayed as 23402

3257


What is a good way to implement complex numbers in c?

603


What is the use of typedef in structure in c?

553


in multiple branching construct "default" case is a) optional b) compulsarily c) it is not include in this construct d) none of the above

645


What is s or c?

608






Is it better to use malloc() or calloc()?

658


What is the difference between null pointer and wild pointer?

648


What is dynamic dispatch in c++?

569


What does int main () mean?

560


What is 1d array in c?

615


how much salary u want ? why u join in our company? your domain is core sector why u prefer software ?

1514


Write a code to achieve inter processor communication (mutual exclusion implementation pseudo code)?

695


Can you please explain the difference between syntax vs logical error?

705


List some of the dynamic data structures in C?

799


Is that possible to add pointers to each other?

909