SlideShare a Scribd company logo
Ternary Operator
Ternary Operators are used on three operands or on
there variables. It is represented with ? : . It is also
called as conditional operator.
Advantage of Ternary Operator
 Using Ternary Operator reduce the number of line
codes and improve the performance of application.
 Syntax:
Expression-1 ? Expression-2 : Expressiion-3
 Example:
a>b ? printf(“a is less”); : printf(“b is less”);
Example of Ternary Operator
#include<stdio.h>
#include<conio.h>
void main()
{
int a, b, c, large;
clrscr();
printf("Enter any three number: ");
scanf("%d%d%d",&a,&b,&c);
large=a>b ? (a>c?a:c) : (b>c?b:c);
printf("Largest Number is: %d",large);
getch();
}
Output:
Enter any three numbers: 10 30 20
Largest number is 30
Reference
http://www.tutorial4us.com/cprogramming/c-ternary-operator

More Related Content

What's hot

Operator in c programming
Operator in c programmingOperator in c programming
Operator in c programming
Manoj Tyagi
 
Operators in c programming
Operators in c programmingOperators in c programming
Operators in c programming
savitamhaske
 
C++
C++C++
Pointers in C Language
Pointers in C LanguagePointers in C Language
Pointers in C Language
madan reddy
 
02 c++ Array Pointer
02 c++ Array Pointer02 c++ Array Pointer
02 c++ Array PointerTareq Hasan
 
Expression and Operartor In C Programming
Expression and Operartor In C Programming Expression and Operartor In C Programming
Expression and Operartor In C Programming
Kamal Acharya
 
C++ programming function
C++ programming functionC++ programming function
C++ programming function
Vishalini Mugunen
 
Pointers C programming
Pointers  C programmingPointers  C programming
Pointers C programming
Appili Vamsi Krishna
 
C pointer
C pointerC pointer
Union in c language
Union  in c languageUnion  in c language
Union in c language
tanmaymodi4
 
C if else
C if elseC if else
C if else
Ritwik Das
 
Pointer in C++
Pointer in C++Pointer in C++
Pointer in C++
Mauryasuraj98
 
Operator precedence and associativity
Operator precedence and associativityOperator precedence and associativity
Operator precedence and associativity
Dr.Sandhiya Ravi
 
Function overloading
Function overloadingFunction overloading
Function overloading
Selvin Josy Bai Somu
 
Control statements in c
Control statements in cControl statements in c
Control statements in c
Sathish Narayanan
 
Conditional operators
Conditional operatorsConditional operators
Conditional operators
BU
 

What's hot (20)

Operator in c programming
Operator in c programmingOperator in c programming
Operator in c programming
 
Operators in c programming
Operators in c programmingOperators in c programming
Operators in c programming
 
C++
C++C++
C++
 
Pointers in C Language
Pointers in C LanguagePointers in C Language
Pointers in C Language
 
Control statement-Selective
Control statement-SelectiveControl statement-Selective
Control statement-Selective
 
02 c++ Array Pointer
02 c++ Array Pointer02 c++ Array Pointer
02 c++ Array Pointer
 
Expression and Operartor In C Programming
Expression and Operartor In C Programming Expression and Operartor In C Programming
Expression and Operartor In C Programming
 
C++ programming function
C++ programming functionC++ programming function
C++ programming function
 
Pointers C programming
Pointers  C programmingPointers  C programming
Pointers C programming
 
Control structures in c
Control structures in cControl structures in c
Control structures in c
 
C pointer
C pointerC pointer
C pointer
 
Preprocessor
PreprocessorPreprocessor
Preprocessor
 
Union in c language
Union  in c languageUnion  in c language
Union in c language
 
C if else
C if elseC if else
C if else
 
Pointer in C++
Pointer in C++Pointer in C++
Pointer in C++
 
Operator precedence and associativity
Operator precedence and associativityOperator precedence and associativity
Operator precedence and associativity
 
Function overloading
Function overloadingFunction overloading
Function overloading
 
Control statements in c
Control statements in cControl statements in c
Control statements in c
 
Conditional operators
Conditional operatorsConditional operators
Conditional operators
 
C – operators and expressions
C – operators and expressionsC – operators and expressions
C – operators and expressions
 

Viewers also liked

1SAMPLE16C3-Economics-Sample-Economics-and-Quantitative-Analysis
1SAMPLE16C3-Economics-Sample-Economics-and-Quantitative-Analysis1SAMPLE16C3-Economics-Sample-Economics-and-Quantitative-Analysis
1SAMPLE16C3-Economics-Sample-Economics-and-Quantitative-AnalysisEmily Parker
 
Textual analysis music video
Textual analysis music videoTextual analysis music video
Textual analysis music video
PRINCE360
 
RAFLL Oct 19 Plenary session 1
RAFLL Oct 19 Plenary session 1RAFLL Oct 19 Plenary session 1
RAFLL Oct 19 Plenary session 1
Malia Bachesta
 
Janeiro 15.01.2016
Janeiro 15.01.2016Janeiro 15.01.2016
Janeiro 15.01.2016
Almir Gomes
 
Rap music
Rap musicRap music
Rap music
PRINCE360
 
Carolina giraldo galvis grado 8°d taller n°13
Carolina giraldo galvis grado 8°d taller n°13Carolina giraldo galvis grado 8°d taller n°13
Carolina giraldo galvis grado 8°d taller n°13
Kariito Giiraldo
 
Un budget infini pour votre événement ça vous dirait ?
Un budget infini pour votre événement ça vous dirait ? Un budget infini pour votre événement ça vous dirait ?
Un budget infini pour votre événement ça vous dirait ?
leconciergemarketing
 
End Of Year Party Ideas
End Of Year Party IdeasEnd Of Year Party Ideas
End Of Year Party IdeasBindigog
 
South Asia Unit
South Asia UnitSouth Asia Unit
South Asia Unit
Mothra Saidian
 
Aeroelasticity
AeroelasticityAeroelasticity
Aeroelasticity
Sagar Chawla
 
computer system
computer system computer system
computer system
AAKASH KUMAR
 
Asuhan keperawatan pada masalah kebutuhan nutrisi
Asuhan keperawatan pada masalah kebutuhan nutrisiAsuhan keperawatan pada masalah kebutuhan nutrisi
Asuhan keperawatan pada masalah kebutuhan nutrisi
Sulistia Rini
 
Livestock: The global context
Livestock: The global contextLivestock: The global context
Livestock: The global context
ILRI
 
Material Administração da Produção e Operações I
Material Administração da Produção e Operações I Material Administração da Produção e Operações I
Material Administração da Produção e Operações I
Cristiano Ferreira Cesarino
 
Paragraph Writing
Paragraph WritingParagraph Writing
Paragraph Writing
m nagaRAJU
 

Viewers also liked (15)

1SAMPLE16C3-Economics-Sample-Economics-and-Quantitative-Analysis
1SAMPLE16C3-Economics-Sample-Economics-and-Quantitative-Analysis1SAMPLE16C3-Economics-Sample-Economics-and-Quantitative-Analysis
1SAMPLE16C3-Economics-Sample-Economics-and-Quantitative-Analysis
 
Textual analysis music video
Textual analysis music videoTextual analysis music video
Textual analysis music video
 
RAFLL Oct 19 Plenary session 1
RAFLL Oct 19 Plenary session 1RAFLL Oct 19 Plenary session 1
RAFLL Oct 19 Plenary session 1
 
Janeiro 15.01.2016
Janeiro 15.01.2016Janeiro 15.01.2016
Janeiro 15.01.2016
 
Rap music
Rap musicRap music
Rap music
 
Carolina giraldo galvis grado 8°d taller n°13
Carolina giraldo galvis grado 8°d taller n°13Carolina giraldo galvis grado 8°d taller n°13
Carolina giraldo galvis grado 8°d taller n°13
 
Un budget infini pour votre événement ça vous dirait ?
Un budget infini pour votre événement ça vous dirait ? Un budget infini pour votre événement ça vous dirait ?
Un budget infini pour votre événement ça vous dirait ?
 
End Of Year Party Ideas
End Of Year Party IdeasEnd Of Year Party Ideas
End Of Year Party Ideas
 
South Asia Unit
South Asia UnitSouth Asia Unit
South Asia Unit
 
Aeroelasticity
AeroelasticityAeroelasticity
Aeroelasticity
 
computer system
computer system computer system
computer system
 
Asuhan keperawatan pada masalah kebutuhan nutrisi
Asuhan keperawatan pada masalah kebutuhan nutrisiAsuhan keperawatan pada masalah kebutuhan nutrisi
Asuhan keperawatan pada masalah kebutuhan nutrisi
 
Livestock: The global context
Livestock: The global contextLivestock: The global context
Livestock: The global context
 
Material Administração da Produção e Operações I
Material Administração da Produção e Operações I Material Administração da Produção e Operações I
Material Administração da Produção e Operações I
 
Paragraph Writing
Paragraph WritingParagraph Writing
Paragraph Writing
 

More from Hitesh Kumar

Abstraction in c++ and Real Life Example of Abstraction in C++
Abstraction in c++ and Real Life Example of Abstraction in C++Abstraction in c++ and Real Life Example of Abstraction in C++
Abstraction in c++ and Real Life Example of Abstraction in C++
Hitesh Kumar
 
HTML Interview Questions | Basic Html Interview Questions
HTML Interview Questions | Basic Html Interview QuestionsHTML Interview Questions | Basic Html Interview Questions
HTML Interview Questions | Basic Html Interview Questions
Hitesh Kumar
 
Fibonacci Series Program in C++
Fibonacci Series Program in C++Fibonacci Series Program in C++
Fibonacci Series Program in C++
Hitesh Kumar
 
CSS Interview Questions for Fresher and Experience
CSS Interview Questions for Fresher and Experience CSS Interview Questions for Fresher and Experience
CSS Interview Questions for Fresher and Experience
Hitesh Kumar
 
Factorial Program in C
Factorial Program in CFactorial Program in C
Factorial Program in C
Hitesh Kumar
 
Prime number program in C
Prime number program in CPrime number program in C
Prime number program in C
Hitesh Kumar
 
Top JSON Interview Questions for Freshers
Top JSON Interview Questions for FreshersTop JSON Interview Questions for Freshers
Top JSON Interview Questions for Freshers
Hitesh Kumar
 
Queue in C, Queue Real Life of Example
Queue in C, Queue Real Life of ExampleQueue in C, Queue Real Life of Example
Queue in C, Queue Real Life of Example
Hitesh Kumar
 
Fibonacci series c++
Fibonacci series c++Fibonacci series c++
Fibonacci series c++
Hitesh Kumar
 
Super keyword in java
Super keyword in javaSuper keyword in java
Super keyword in java
Hitesh Kumar
 
Interface in java
Interface in javaInterface in java
Interface in java
Hitesh Kumar
 
Encapsulation in C++
Encapsulation in C++Encapsulation in C++
Encapsulation in C++
Hitesh Kumar
 
Abstract class in java
Abstract class in javaAbstract class in java
Abstract class in java
Hitesh Kumar
 
Super keyword in java
Super keyword in javaSuper keyword in java
Super keyword in java
Hitesh Kumar
 
Final keyword in java
Final keyword in javaFinal keyword in java
Final keyword in java
Hitesh Kumar
 
Constructor in java
Constructor in javaConstructor in java
Constructor in java
Hitesh Kumar
 
Super keyword in java
Super keyword in javaSuper keyword in java
Super keyword in java
Hitesh Kumar
 
File handling in C++
File handling in C++File handling in C++
File handling in C++
Hitesh Kumar
 
Main method in java
Main method in javaMain method in java
Main method in java
Hitesh Kumar
 
This keyword in java
This keyword in javaThis keyword in java
This keyword in java
Hitesh Kumar
 

More from Hitesh Kumar (20)

Abstraction in c++ and Real Life Example of Abstraction in C++
Abstraction in c++ and Real Life Example of Abstraction in C++Abstraction in c++ and Real Life Example of Abstraction in C++
Abstraction in c++ and Real Life Example of Abstraction in C++
 
HTML Interview Questions | Basic Html Interview Questions
HTML Interview Questions | Basic Html Interview QuestionsHTML Interview Questions | Basic Html Interview Questions
HTML Interview Questions | Basic Html Interview Questions
 
Fibonacci Series Program in C++
Fibonacci Series Program in C++Fibonacci Series Program in C++
Fibonacci Series Program in C++
 
CSS Interview Questions for Fresher and Experience
CSS Interview Questions for Fresher and Experience CSS Interview Questions for Fresher and Experience
CSS Interview Questions for Fresher and Experience
 
Factorial Program in C
Factorial Program in CFactorial Program in C
Factorial Program in C
 
Prime number program in C
Prime number program in CPrime number program in C
Prime number program in C
 
Top JSON Interview Questions for Freshers
Top JSON Interview Questions for FreshersTop JSON Interview Questions for Freshers
Top JSON Interview Questions for Freshers
 
Queue in C, Queue Real Life of Example
Queue in C, Queue Real Life of ExampleQueue in C, Queue Real Life of Example
Queue in C, Queue Real Life of Example
 
Fibonacci series c++
Fibonacci series c++Fibonacci series c++
Fibonacci series c++
 
Super keyword in java
Super keyword in javaSuper keyword in java
Super keyword in java
 
Interface in java
Interface in javaInterface in java
Interface in java
 
Encapsulation in C++
Encapsulation in C++Encapsulation in C++
Encapsulation in C++
 
Abstract class in java
Abstract class in javaAbstract class in java
Abstract class in java
 
Super keyword in java
Super keyword in javaSuper keyword in java
Super keyword in java
 
Final keyword in java
Final keyword in javaFinal keyword in java
Final keyword in java
 
Constructor in java
Constructor in javaConstructor in java
Constructor in java
 
Super keyword in java
Super keyword in javaSuper keyword in java
Super keyword in java
 
File handling in C++
File handling in C++File handling in C++
File handling in C++
 
Main method in java
Main method in javaMain method in java
Main method in java
 
This keyword in java
This keyword in javaThis keyword in java
This keyword in java
 

Recently uploaded

Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
Celine George
 

Recently uploaded (20)

Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 

Ternary operator

  • 1.
  • 2. Ternary Operator Ternary Operators are used on three operands or on there variables. It is represented with ? : . It is also called as conditional operator.
  • 3.
  • 4. Advantage of Ternary Operator  Using Ternary Operator reduce the number of line codes and improve the performance of application.  Syntax: Expression-1 ? Expression-2 : Expressiion-3  Example: a>b ? printf(“a is less”); : printf(“b is less”);
  • 5.
  • 6. Example of Ternary Operator #include<stdio.h> #include<conio.h> void main() { int a, b, c, large; clrscr(); printf("Enter any three number: "); scanf("%d%d%d",&a,&b,&c); large=a>b ? (a>c?a:c) : (b>c?b:c); printf("Largest Number is: %d",large); getch(); } Output: Enter any three numbers: 10 30 20 Largest number is 30