Tuesday, 4 October 2016

To find which is greatest among given 3 nos.

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,c;
cout<<“Enter the first number “;
cin>>a;
cout<<“Enter the second number “;
cin>>b;
cout<<“Enter the third number “;
cin>>c;
if (a>b)
{ if (a>c)
{ cout<<“a is largest number “;
}
else
{cout<<“c is largest number “;
}
}
else
{ if (b>c)
{ cout<<“b is largest number “;
}
else
{cout<<“c is largest number “;
}
}
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...