- 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 Largest Number Among Three Numbers
This program takes the 3 numbers and finds the biggest among all. For this, we will compare the numbers with each other and find out which is the largest
Input: a=2,b=4,c=7 Output:7 Largest Number
Explanation
This program uses only if statement to find the largest number.
Example
#include <iostream> using namespace std; int main() { int a,b,c; a=2,b=4,c=7; if(a>b) { if(a>c) { printf("%d Largest Number ",a); } else { printf("%d Largest Number ",c); } } else { if(b>c) { printf("%d Largest Number ",b); } else { printf("%d Largest Number ",c); } } return 0; }
Advertisements