Tuesday, 4 October 2016

To find largest and smallest amongg given 3 nos. using Conditional Statement .

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,c,d,e;
cout<<“a = “;
cin>>a;
cout<<“b = “;
cin>>b;
cout<<“c = “;
cin>>c;
d=a>b?(a>c?a:c):(b>c?b:c);
e=a<b?(a<c?a:c):(b<c?b:c);
cout<<“Largest no. is = “<<d;
cout<<“Smallest no. is = “<<e;
getch();
}

No comments:

Post a Comment

Basic Implementation of Array as a Pointer

#include<iostream.h> #include<conio.h> void main() { clrscr();   int arr[5];   cout<<"Enter 5 nos. ";   f...