Q. Assume that the array have size 10. WAP to request the 10 integers from users.
Store it into array and display the smallest number among the entered number
==> Code goes like this
#include <stdio.h>
#define SIZE 10
int main() {
int a[SIZE],small,i;
printf("\n Enter %d element of array :",SIZE);
for(i=0;i<10;i++)
{
scanf("%d",&a[i]);
}
small=a[0];
//Swapping for smallest
for(i=0;i<10;i++)
{
if(small>a[i])
{
small=a[i];
}
}
printf("\n The smallest number in array is %d",small);
return 0;
}
Output:
If you have any confusion regarding the program, please, comment below.
Happy Coding !
Thank you
- Blogger Comment
- Facebook Comment
Subscribe to:
Post Comments
(
Atom
)
0 comments:
Post a Comment