Thursday, 13 October 2016

HHW Q8. WAP to find greatest among 3 entered nos.

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,c,d;
cout<<"Enter 3 nos. ";
cin>>a>>b>>c;
d=a>b?(a>c?a:c):(b>c?b:c);
cout<<"Largest no. = "<<d;
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...