program to find a smallest number in an array
Answer Posted / 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 |
Post New Answer View All Answers
What does %c mean in c?
What is an endless loop?
What is break statement?
Why does this code crash?
Tell us two differences between new () and malloc ()?
What is d scanf?
How do you construct an increment statement or decrement statement in C?
What is main () in c language?
There is a practice in coding to keep some code blocks in comment symbols than delete it when debugging. How this affect when debugging?
What does s c mean on snapchat?
Is boolean a datatype in c?
What does struct node * mean?
Can an array be an Ivalue?
How was c created?
How can I trap or ignore keyboard interrupts like control-c?