program to find a smallest number in an array
Answers were Sorted based on User's Feedback
Answer / sathish
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 ? | 138 Yes | 57 No |
Answer / vignesh1988i
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 ? | 59 Yes | 30 No |
Answer / .::get lost::.
#include<stdio.h>
#include<conio.h>
void 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);
getch();
}
Is This Answer Correct ? | 24 Yes | 10 No |
Answer / rose
#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 ? | 19 Yes | 15 No |
Answer / 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 |
Answer / asif ali afsar
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],b,c,n;
clrscr();
printf("How many size you want to Cheah\n");
scanf("%d",&n);
printf("Enter the numbers\n");
for(b=0; b<n; b++)
{
scanf("%d",&a[b]);
}
for(b=0; b<n; b++)
{
if(c<a[b])
{
c=c;
}
else
{
c=a[b];
}
}
printf("smalest no is %d",c);
getch();
}
Is This Answer Correct ? | 3 Yes | 1 No |
Answer / farhana parvin sunny
#include<stdio.h>
#include<conio.h>
int main(void)
{
int n,i,l,a[10];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
l=a[0];
for(i=0;i<n;i++)
{
if(l>a[i])
{
l=a[i];
}
}
printf("the lowest number is %d",l);
getch();
return 0;
}
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / azhar shaik
int n, i,small,a[30];
clrscr();
pf("enter the no.of elements in an array");
sf("%d",&n);
pf("enter the elements \n");
for(i=0;i<n;i++)
{
pf("a[%d]= ,"i);
sf("%d\n",&ai[i]);
}
pf(" displaty the array elements ");
for(i=0;i<n;i++)
{
pf("%d\t",a[i]);
}
pf("smallest element from an array "):
small=a[0];
for(i=1;i<n;i++)
{
if(small>a[i])
{
small=a[i];
}
pf("smallest element is %d ",small);
getch();
}
hint:pf =print f ,sf =scan f
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / subash
&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;
Is This Answer Correct ? | 0 Yes | 0 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[j];
a[j]=temp;
}
}
printf("The smallest element is %d",a[0]);
getch();
}
Is This Answer Correct ? | 26 Yes | 28 No |
What does emoji p mean?
How to draw the flowchart for structure programs?
What are variables c?
Write a C function to search a number in the given list of numbers. donot use printf and scanf
In how much time you will write this c program? Prime nos from 1 to 1000
What is "Duff's Device"?
how can you print&scan anything using just one character? :) HINT: printf,scanf similer
What is a Genralised LInked List?? Please give a detailed explation of it..
Please write the area of a RIGHT ANGLED TRIANGLE.
"C" language developed by "Dennis Ritchie" at AT & T. his remarks are a) too general, too abstract b) could deal with only specific problems c) lost generality of BCPL and B restored d) no remarks
how to make program without <> in library.
Write a program using bitwise operators to invert even bits of a given number.