- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- 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
C++ program to find the smallest element among three elements
In this tutorial, we will be discussing a program to find the smallest element among the provided three elements.
We will be provided with three elements/ integers and our task is to compare them and find the smallest element/ integer among them.
Example
#include <bits/stdc++.h> using namespace std; int main() { int a = 45, b = 72, c = 10; if (a <= b && a <= c) cout << a << " is smallest" << endl; else if (b <= a && b <= c) cout << b << " is smallest" << endl; else cout << c << " is smallest" << endl; return 0; }
Output
10 is smallest
Advertisements