- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Environmental Science
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Write C Program to Find Smallest Element in Array in C Programming
Program : Find Smallest Element in Array in C Programming
#include <stdio.h>
int main() {
int a[30], i, num, smallest;
printf("\nEnter no of elements :");
scanf("%d", &num);
//Read n elements in an array
for (i = 0; i < num; i++)
scanf("%d", &a[i]);
//Consider first element as smallest
smallest = a[0];
for (i = 0; i < num; i++) {
if (a[i] < smallest) {
smallest = a[i];
}
}
// Print out the Result
printf("\nSmallest Element : %d", smallest);
return (0);
}
Output :
Enter no of elements : 5
11 44 22 55 99
Smallest Element : 11
- Related Questions & Answers
- Write C Program to Calculate Addition of All Elements in Array
- How to convert temperature from degree centigrade to Fahrenheit using C
- Write C Program to Reversing an Array Elements in C Programming
- How to find area and circumference of circle using C Programming
- Write C Program to Find Largest Element in Array in C Programming
- How to Find Area of Scalene Triangle using C
- How to read the values of x, y and z and print the results expressions in one line using C Program
- Write a ‘C’ Program to compute the sum of all elements stored in an array using pointers
- Find Second largest element in an array using C Programming
- How to Calculate Area of Circle using C Programming
- How to Calculate Area of Rectangle using C Program
- Write C Program to Find Smallest Element in Array in C Programming
- How to Calculate Area of Right angle Triangle using C Language
- How to print hello world using C Language
- Write C Program to Delete duplicate elements from an array
- How to find sum of two numbers using C Language
Advertisements
ads