program to find a smallest number in an array
Answers were Sorted based on User's Feedback
Answer / suse
main()
{
int a[20],n,i,s;
scanf("%d,%d",&n,&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 ? | 5 Yes | 7 No |
Answer / kalee
// Algorithm
Add the numbers directly into a set<double> varible, while getting the values from keyboard. First element of this set will be the least integer
This is a bad answer , if memory constraint is to be taken into account
| Is This Answer Correct ? | 4 Yes | 9 No |
Answer / belsia
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 ? | 7 Yes | 17 No |
Answer / atul kumar
#include<iostream.h>
void main()
{
int a, b[4]=[1,2,3,4];
a[0]=b[0];
for(i=1;i<=5;i++)
{
if(a>b[i])
{
a=b[i];
}
}
cout<<"smallest num"<<a;
}
| Is This Answer Correct ? | 7 Yes | 18 No |
How can I call system when parameters (filenames, etc.) Of the executed command arent known until run time?
What does 3 periods mean in texting?
What should be keep precautions while using the recursion method?
what is the difference between postfix and prefix unary increment operators?
What are static variables in c?
progrem to generate the following series 1 12 123 1234 12345
I need to take a sentence from input and sort the words alphabetically using the C programming language. Note: This is C not C++. qsort and strtok not allowed
Explain what are global variables and explain how do you declare them?
What is s or c?
How many identifiers are there in c?
What is the proper way of these job Tell me about there full work
Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.