/*
* 1000+ C programs + tutorials
*
*
* 51_c_program_to_find_greatest_among_2_numbers_using_ternary_operator
*
*
* Created on: Oct 20, 2014
* Author: Code2care.org
*/
#include
//#include <conio.h>
void main() {
int number1,number2;
// clrscr();
printf("C Program to find Greatest of Two numbers using Ternary Operator : ");
printf("\n\n Enter number 1 : ");
scanf("%d", &number1);
printf("\n\n Enter number 2 : ");
scanf("%d", &number2);
(number1 > number2) ? printf("\n\n %d is greater then %d",number1,number2) : printf("\n\n %d is greater then %d",number2,number1);
// getch();
}
-
Output :
C Program to find Greatest of Two numbers using Ternary Operator :
Enter number 1 : 1
Enter number 2 : 2
2 is greater then 1
The best way to learn C programming is to practice more and more of programs .
Code2care C Programming tutorials provide 1000+ programs in C that you can study and become an expert in the language. Programs are divided into categories depending upon type and complexity.
BSc. IT, BSc. Computer Science, BSc. IT, MSc. IT, MSc. Computer Science, MCA, BTech IT & BTech Engineers may find these programs very useful.