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
What is the difference between new and malloc functions?
What is advantage of pointer in c?
How can you convert integers to binary or hexadecimal?
Explain what are header files and explain what are its uses in c programming?
Are the variables argc and argv are local to main?
What are the types of bitwise operator?
Why are all header files not declared in every c program?
What is bin sh c?
What is 2c dna?
What are directives in c?
Can a void pointer point to a function?
What is structure in c definition?
I heard that you have to include stdio.h before calling printf. Why?
What is the newline escape sequence?
What is an endless loop?