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 |
If you know then define #pragma?
What is formal argument?
write a program that finds the factorial of a number using recursion?
Write a C/C++ program that connects to a MySQL server and checks intrusion attempts every 5 minutes. If an intrusion attempt is detected beep the internal speaker to alert the administrator. A high number of aborted connects to MySQL at a point in time may be used as a basis of an intrusion.
2 Answers Drona Solutions, Infosys, Vodafone, Webyog,
Write a function which takes as parameters one regular expression(only ? and * are the special characters) and a string and returns whether the string matched the regular expression.
write a C program: To recognize date of any format even formats like "feb-02-2003","02-february-2003",mm/dd/yy, dd/mm/yy and display it as mm/dd/yy.
Why c is a procedural language?
the number 138 is called well ordered number because the three digits in the number (1,3,8) increase from left to right (1<3<8). the number 365 is not well ordered coz 6 is larger than 5. write a program that wull find and display all possible three digit well ordered numbers. sample: 123,124,125,126,127,128,129,134 ,135,136,137,138,139,145,146,147 148 149,156.......789
GIven a sequence of characters. How will you convert the lower case characters to upper case characters. ( Try using bit vector - sol given in the C lib -> typec.h)
What is scanf () in c?
Explain is it better to bitshift a value than to multiply by 2?
What is meant by realloc()?