program to find a smallest number in an array

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between function overloading and operator overloading?

664


Explain how many levels deep can include files be nested?

632


What is meant by gets in c?

613


What is the difference between a string and an array?

714


How to throw some light on the b tree?

609






What are pointers in C? Give an example where to illustrate their significance.

755


A banker has a seif with a cipher. Not to forget the cipher, he wants to write it coded as following: each digit to be replaced with the difference of 9 with the current digit. The banker chose a cipher. Decipher it knowing the cipher starts with a digit different than 9. I need to write a program that takes the cipher from the keyboard and prints the new cipher. I thought of the following: Take the input from the keyboard and put it into a string or an array. Go through the object with a for and for each digit other than the first, substract it from 9 and add it to another variable. Print the new variable. Theoretically I thought of it but I don't know much C. Could you give me any kind of hint, whether I am on the right track or not?

1516


What is union and structure in c?

624


What do you know about the use of bit field?

618


What is 'bus error'?

651


What are the similarities between c and c++?

605


What is the use of ?

631


What is the purpose of main( ) in c language?

630


Can we compile a program without main() function?

637


What is typedef struct in c?

592