Skip to content

Instantly share code, notes, and snippets.

@nalin-adh
Created November 8, 2015 18:13
Show Gist options
  • Save nalin-adh/d57a6ad7c08f1ee0807e to your computer and use it in GitHub Desktop.
Save nalin-adh/d57a6ad7c08f1ee0807e to your computer and use it in GitHub Desktop.
A C++ program that finds smallest among four numbers using conditional operator.
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int a,b,c,d,l;
cout<<"a=";
cin>>a;
cout<<"b=";
cin>>b;
cout<<"c=";
cin>>c;
cout<<"d=";
cin>>d;
l=a>b?a:b;
l=l>c?l:c;
l=l>d?l:d;
cout<<"Greatest number="<<l<<endl;
getch();
return(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment